In brief
In testing payment systems, most errors hide not in the happy path of a transfer but in time, exceptions, and reconciliations: in cutoff times and non-business days, in duplicates and resubmissions, in refunds and rejections, in timeouts between systems, and in balance consistency on both sides. A good test plan covers every stage of a payment's life, from receiving the order to settlement, on data resembling production and with control totals after every run.
What sets payments apart from other systems
A payment system moves money between parties that cannot see each other's systems. The sender's bank, the clearing house, and the recipient's bank keep their own ledgers, and a payment is correct only when all three agree on the amount, the date, and the status. An error that in an online store ends in a customer service ticket means, in payments, a double debit on an account or money that exists on neither side.
That is why payment tests are planned from risk, not from a list of screens. The question is: where can money vanish, get duplicated, or get stuck. We describe a method for ordering tests by risk in the article Risk-based testing.
The second characteristic of payments is the number of parties the team does not control: clearing houses, card schemes, correspondent banks, sanctions systems. Each has its own specification, its own test environment, and its own change calendar, so the test plan must take into account certification test deadlines and the windows in which partners make their environments available.
Data and messages: from IBAN to ISO 20022
The first layer of testing is the correctness of the data the system accepts and sends.
- Account numbers. An IBAN has check digits calculated with a modulo 97 algorithm, so the system should reject a number with an error in a single digit. Tests also cover foreign numbers of a different length and numbers with spaces.
- Amounts and currencies. Rounding, amounts with cents at the edge of a limit, currencies with a different number of decimal places, exchange rate conversions, and fees.
- Messages. More and more payment systems exchange data in the ISO 20022 standard, in which an interbank transfer is described by a pacs.008 message and the payment status by a pacs.002 message. Tests check conformance with the schema, but also what happens to fields that do not exist in the old format: longer names, a structured address, the originator's data.
- Characters. Polish letters in the transfer title and the recipient's name, characters not allowed in a given scheme, and truncation of fields that are too long.
Message tests automate well. SOAP and REST interfaces between the payment system and the rest of the bank can be checked with tools such as SoapUI, and changes to them are guarded by API contract tests.
Time: sessions, non-business days, and cutoff times
The hardest test cases in payments concern time. Standard transfers are settled in sessions, and an order placed after the cutoff time goes to the next session or to the next business day. Public holidays in Poland, non-settlement days in euro clearing systems, and the switch from summer to winter time create combinations that nobody will check by hand in the last week before deployment.
It is worth adding to the test plan:
- an order placed one minute before and one minute after the cutoff time;
- an order with a future date that falls on a non-business day;
- standing orders on the last day of the month, when the month has 28, 30, or 31 days;
- the night of the clock change, when one hour occurs twice or not at all;
- year-end, when the financial year is closed.
Time tests require an environment in which you can control the system clock and the business day calendar. Without that, such cases only surface in production. Instant payments run without sessions but have their own timing requirements, which we describe in the article Instant payments and the architecture of bank systems.
Exceptions: duplicates, refunds, and timeouts
The happy path of a transfer is usually checked. Production errors come from exceptions:
| Situation | What to check |
|---|---|
| The customer clicks "Send" twice | Whether the system recognizes the repeated order and does not debit the account twice |
| The response from the clearing house does not arrive in time | What status the customer sees and whether resubmission does not create a duplicate |
| The recipient's bank rejects the payment | Whether the funds return to the account with the correct description and date |
| A refund or refund request after settlement | Whether the posting of the refund is linked to the original payment |
| Insufficient funds after authorization | Whether the hold and the posting are consistent |
The most dangerous is the uncertain state: the system sent the payment but does not know whether it arrived. Every component should then behave according to a single written rule, and tests should force such a state, for example through an artificial delay or a dropped connection in a clearing house simulator. In card systems there are also authorizations, settlements, and chargebacks, which B2Bnetwork engineers checked in the end-to-end testing of a new card system.
Reconciliations, test data, and environment
Every payment test run should end with a reconciliation: the sum of debits on the sender's side equals the sum of credits on the recipient's side plus rejections and fees. A reconciliation performed automatically after every regression run catches errors that are invisible in a single test case, for example an order lost in a batch of a thousand transfers.
Test data in payments is personal and financial data, so an unmasked copy of production is out of the question. We describe methods of anonymization and generating synthetic data in the article Test data and GDPR. The test environment also needs simulators of external systems: the clearing house, card schemes, the sanctions system. A simulator should be able to reject, delay, and lose a message, because these are the behaviors tested least often.
For card data, the PCI DSS standard applies, which defines how card numbers may be stored and processed. The test environment should not contain real card numbers, and tests should check that the number does not end up in full in the logs.
Questions and answers
Which payment test cases are most often skipped?
The most often skipped are cases involving time and the uncertain state: an order just after the cutoff time, a future date on a non-business day, the night of the clock change, no response from the clearing house, and resubmission after a timeout. They require clock control and simulators, so they are easy to put off, yet they are where double debits and lost payments come from.
Can payment tests be fully automated?
Most can: message validation, status paths, exceptions, and balance reconciliations can be run automatically with every release. It is worth leaving exploratory testing of new features and the review of reconciliation results to humans when a difference appears. Automation requires simulators of external systems and stable test data.
Why reconcile balances after every test run?
Because a single test case can pass, and yet in a batch of payments one disappears or gets posted twice. An automatic reconciliation compares the sums of debits, credits, rejections, and fees on both sides and shows the difference immediately. It is the cheapest way to catch an error that no single test sees.
Can a copy of production data be used for payment tests?
Not without masking. Payment data contains personal data and account numbers, and for cards also data covered by PCI DSS. Anonymized or synthetic data is safer, as long as it preserves the distribution of amounts, currencies, and transaction types from production. It lets you test realistic cases without the risk of a leak.