In brief
A card transaction goes through two separate stages: authorization, in which the issuing bank approves or declines the transaction in a fraction of a second, and clearing, in which the data for posting and settlement arrives hours or days later. End-to-end tests of a card system must take the same transactions through both stages, because most defects appear at the seam: a clearing amount different from the authorization, a refund with no original transaction, an authorization never cleared that keeps the customer's funds on hold.
Who takes part in a card transaction
A typical transaction involves five parties: the cardholder, the card issuing bank, the merchant, the acquirer that runs the merchant's terminal or payment gateway, and the card scheme that connects issuers with acquirers and sets the scheme rules. On the card side, an issuing bank's systems usually include:
- card management system: issuing, activation, blocking, renewal, limits;
- authorization host: an online decision on every transaction, checking balance, limits, card status and risk rules;
- hardware security module (HSM): keys, PIN and card cryptogram verification;
- clearing module: receiving clearing files from the card scheme, matching them to authorizations, posting in the core banking system;
- dispute handling: complaints and chargebacks;
- fees and statements: commissions, currency conversion, customer statements.
Each of these is run by a different team and often a different vendor, which is why testing a single module is not enough.
Authorization: a decision in a fraction of a second
An authorization is a request that travels from the acquirer through the card scheme to the issuing bank. The authorization host checks the card, funds, limits and risk and returns an approval or a decline with a reason code. On approval the bank places a hold on the customer's account.
Important variants to support and test:
| Variant | What it is | Typical problem |
|---|---|---|
| Pre-authorization | A hold on an estimated amount, e.g. at a hotel or fuel station | Final amount differs from the hold, hold not released after clearing |
| Reversal | Cancelling an authorization after an error or a timeout | The hold stays even though there was no transaction |
| Refund | The merchant returns money for a purchase | Refund not matched to the original transaction, a different currency |
| Contactless transaction without PIN | An exemption from strong customer authentication | Incorrect counters for the cumulative amount and number of transactions |
| Online payment with 3-D Secure | Cardholder authentication before authorization | The challenge path does not work in the mobile app |
| No response from the issuer | A timeout or a host failure | Mismatch between the state at the bank and at the acquirer |
The contactless exemption comes from Regulation 2018/389: a bank may skip strong customer authentication when a single transaction does not exceed EUR 50 and, since the last strong authentication, the total of contactless transactions has not exceeded EUR 150 or their number has not exceeded five. The counters for these values are issuer-side logic, so every boundary needs a test case. We cover exemptions in more detail in the article on strong customer authentication.
For online payments the authentication standard is EMV 3-D Secure, developed by EMVCo. The merchant passes data about the transaction and the device to the issuer, and the issuer decides whether to let the payment through without an extra step or to ask the customer to confirm, for example in the bank's app.
Clearing and settlement: the second half of the transaction
After authorization the merchant submits the transaction for clearing. The card scheme passes clearing data to the issuer, usually in files on set cycles. The clearing module matches each item to an authorization, posts it, releases the hold and calculates fees. Settlement, the actual movement of funds between banks, follows the card scheme's rules.
This stage reveals defects that authorization tests will not show:
- a clearing item with no authorization, for example an offline transaction;
- an amount different from the authorization, for example a tip or fuel;
- currency conversion at a rate from a different day than the authorization;
- a duplicate item in a file or a file delivered twice;
- a hold that expires before clearing arrives.
The issuing bank also calculates and collects fees. For consumer card transactions in the EU, Regulation (EU) 2015/751 caps the interchange fee at 0.2% of the transaction value for debit cards and 0.3% for credit cards, and member states may set lower caps for domestic transactions. Fee tables are a good candidate for decision table testing.
How to plan end-to-end tests
An end-to-end test in a card system takes one transaction through every stage: card issuance, authorization, clearing, posting, the statement and in some cases a dispute. The plan usually has four layers:
- Card scheme and acquirer simulators. They let you send any authorization and any clearing file without a real terminal, including rare cases such as a reversal after a timeout.
- Test cards and physical terminals. Needed to check the chip, PIN and contactless transactions. Test cards are used rather than real card numbers, because card data is subject to PCI DSS requirements.
- A test calendar. Transactions have to be scheduled to cover the day boundary, a weekend, the end of the month and the credit card billing cycle, because some logic runs only at those moments.
- Reconciliation. After every run the totals of authorizations, clearing items, postings and holds must agree. A mismatch of one transaction is a defect, not noise.
The scope and order of tests are best set with risk-based testing, where we use a card system replacement matrix as the example. Replacing the system adds the migration of cards, limits and open holds, which we cover in the article on migrating customer data without interrupting service. The whole program is shown in the end-to-end testing scenario for a new card system.
Performance and resilience
The authorization host works in real time and has peaks that cannot be moved: before holidays, on paydays, during evening shopping hours. Performance tests should measure response time percentiles, not the average, and cover the moment when batch clearing runs in the background. Separately you need to check what happens when the host fails: whether the card scheme takes over decisions on the issuer's behalf according to agreed parameters, and whether, once the system is back, the bank correctly reconciles transactions approved in the meantime. General principles of payment testing are described in the article on testing payment systems.
Questions and answers
What is the difference between authorization and clearing of a card transaction?
Authorization is the online decision the issuing bank makes at the moment of payment: it checks the card, funds and risk, and on approval places a hold on the account. Clearing comes later, usually in files from the card scheme, and only clearing causes the transaction to be posted and the hold to be released. The clearing amount can differ from the authorization, and some transactions arrive for clearing without an online authorization.
Why does a card hold not disappear after a purchase?
Most often because clearing has not arrived yet or was not matched to the authorization, for example because of a different amount or currency. Sometimes the merchant did not send a reversal after cancelling the transaction. Each of these cases should have an end-to-end test with reconciliation of hold balances, because to the customer it looks like a double charge.
Can real cards be used to test a card system?
Test environments use test cards and simulators, not real customer card numbers. Card data is subject to PCI DSS requirements, and a test environment usually lacks the safeguards of production. Real cards appear only in controlled production tests, for example a pilot with employees.
How long does end-to-end testing take when replacing a card system?
It depends on the number of products, channels and integrations, so there is no single answer. The schedule is driven especially by testing with the card scheme, credit card billing cycles that have to be run at least once, and migration dress rehearsals. It is worth building the plan from the calendar of events that must happen rather than from the number of test cases.