Insights Contact

Cards

Card Payments, Step by Step: ISO 8583, Clearing, Rules and PCI Security

By SP Sankar

⏱ About a 5-minute read. Click “Read more” or “Sample file” whenever you want the details.

Sree taps a card for $64 at a store. The answer comes back in about a second, but the actual money moves the next day.

  • Not a banker? Just look at the pictures and read the “In one line” boxes. That is enough to get the idea.
  • Work in banking or operations? Open “Read more” under each file and each payment type.
  • Product owner? Read the status codes, the “Status, rules, security and data” boxes and the product owner rows. Those are the decisions that land on your desk.
  • Developer? Open every “Sample file”, then read the data mapping section and the developer rows.
  • Operations or support? Use the runbook table: what to watch at each file, and who acts.
  • Tester? Use the “What to test” rows as your starting checklist.
  • Forward deployed engineer? Jump to “For forward deployed engineers”. It covers what to ask the client, set-up, testing, go-live and where things usually go wrong.

How card payments work

In one line: The approval takes seconds, using ISO 8583 messages. The money moves later, in clearing files.

CUSTOMERYOUR BANK · INTERNALOUTSIDE · EXTERNALShopper+ merchanttap · online · Apple PayGatewayacquirerprocessorValidate+ maptokens · carddata protectedChecks+ postfraud scorerisk rulesVisa · MCAmex · Disc.card networksIssuingbankyes or noGateway API (JSON)ISO 8583 authISO 8583COMING BACKApprove/decline · chargebacksapproval codeReconcile: bank books vs networkClearing file = authorizationsStatementsettlement reportsettlement reportwhat the networksays movedApproval in seconds · money moves next day in clearing files (Visa BASE II, Mastercard IPM)ledger postings
Cards: what comes in, what goes out, what comes back, and how the bank checks it all matches.
  • Coming in: a call to the payment gateway API (JSON), or a card terminal.
  • Going out: an ISO 8583 approval request to Visa, Mastercard, Amex or Discover.
  • Coming back: approved or declined. Clearing files the next day. Sometimes, later, a chargeback.

Status, rules, security and data

Status flowAuthorized → Captured → Cleared → Settled
Side paths: Declined, Reversed, Chargeback
Regulation and rulesThe card network rules. Regulation E for debit cards and Regulation Z for credit cards, when the cardholder is a consumer.
Security standardsPCI DSS applies to anyone who stores, processes or sends card data. EMV chips and tokens (used by Apple Pay and Google Pay) protect the card number.
Data governanceNever store full card numbers or security codes. Use tokens instead. Keep evidence in case of a dispute.
Read more: Cards

For tech teams, product owners and testers

For developersTurn card numbers into tokens as early as possible. Send a reversal when a request times out. Match approvals to clearing records.
For product ownersHow to handle declines, the fees for each network, and how disputes are handled.
What to testA partial approval. A reversal after a timeout. A capture with no approval behind it. A chargeback and the merchant’s response (representment).

Step by step

  1. The terminal or website sends the request to the merchant’s processor (the acquiring side).
  2. The processor sends an ISO 8583 approval request (0100) through Visa, Mastercard, Amex or Discover to the bank that issued the card.
  3. The issuing bank checks the balance, the limits and for fraud. It answers (0110) with a code, such as 00 for approved.
  4. At the end of the day, the merchant “captures” the approved sales, which means it asks to be paid for them.
  5. The next day, clearing files move between the banks, and the merchant gets paid.
  6. Weeks later, a customer may dispute a charge. The chargeback and the merchant’s response follow the network’s rules.

When things go wrong: rejected, returned, cancelled

Not every payment goes through. On Cards, there are three ways a payment can fail. Each one means something different for the money.

Cards: rejected, returned and cancelledRejectedin a secondCard bank says noDecline code0110 · DE39 51Shopper tries againReturneddays laterMerchant refundsrefund recordOr shopper disputeschargebackMoney back to cardCancelledbefore captureSale cancelledHold released0400 reversalNothing is chargedRejected = money never moved · Returned = money moved, then came back · Cancelled = stopped (or recalled) by the sender
Navy: the money never moved. Blue: it moved and came back. Grey: the sender stopped it.

Rejected. The card-issuing bank declines the request in about a second, for example 05 (do not honor) or 51 (not enough money). The answer is a 0110 with the decline code. No money is held.

Returned. Money goes back in two ways. The merchant can give a refund, which is a credit sent through the clearing files. Or the cardholder can dispute the charge with their bank, which starts a chargeback. The merchant can answer it with evidence (representment).

Cancelled. If the sale is cancelled before the merchant captures it, the merchant sends a reversal (0400). This releases the hold, and nothing appears on the statement. A reversal is also sent automatically when a request times out.

Codes you will see: 00 approved · 05 do not honor · 14 bad card number · 51 not enough money · 54 expired card · 91 issuer unavailable

Which files carry the bad news?

Each path has its own file or message. Here is what travels, who sends it, and what is inside.

PathFile or messageFrom → toWhat it says
RejectedISO 8583 0110 with DE39 decline codeIssuer → network → acquirer05, 51, 54 …
CancelledISO 8583 0400 / 0410 reversalAcquirer → network → issuerRelease the hold
Returned (refund)Credit record in the clearing fileAcquirer → network → issuerMoney back to the card
Returned (chargeback)Chargeback record in the clearing fileIssuer → network → acquirerDispute reason, amount, deadline
Sample file: ISO 8583 decline and reversal

Fictional data, shortened. Real files carry more fields.

0100  Authorization request
  DE2   4111 11** **** 1111        card number (masked here)
  DE4   000000006400              $64.00
  DE11  004521                    STAN (trace number)
0110  Authorization response
  DE39  51                        declined: not enough money

0400  Reversal (sale cancelled, or 0110 never arrived)
  DE4   000000006400
  DE11  004533
  DE90  0100 004521 1120143005 ...  original MTI, STAN, date and time
0410  Reversal response
  DE39  00                        hold released
Sample file: Refund and chargeback records

Fictional data, shortened. Real files carry more fields.

Daily clearing file (shown as plain text; real files are binary network formats)

REFUND   merchant=SREE GIFTS  card=4111********1111  amount=-64.00
         original_auth=004521  original_date=2026-11-20  reason=customer return

CHARGEBACK (for example Mastercard IPM message 1442, first chargeback)
         card=5500********0004  amount=64.00  reason=item not received
         original_ARN=74123456789012345678901  respond_by=2026-12-29

Cards runbook: what to watch at each file

This is the day-to-day runbook for the files above, in the same order. For each step: the file you are looking at, what “good” looks like, what to do when it isn’t, and who acts. L1 is the service desk, L2 is payment operations and app support, and L3 is engineering.

StepFileCheckIf it goes wrongWho
1. Approval requestISO 8583 0100Fast answer, card data tokenized, no full card number in logs.Approval rate drops? Check the network and issuer status first.L2, L3 if it’s technical
2. AnswerISO 8583 0110 (DE39)Approvals and declines look normal.Spike in one decline code? Investigate before customers complain.L2
3. TimeoutISO 8583 0400 / 0410Every timeout gets a reversal.Reversal missing? Send it. Otherwise the shopper’s money stays on hold.L2
4. CaptureEnd-of-day batchCaptured amounts match the approvals.Capture without an approval? Stop it and investigate.L2
5. Clearing and settlementNetwork clearing filesCleared equals settled, merchant paid on time.Break? Open an item and own it.L2 with finance
6. Refunds and chargebacksRefund and chargeback recordsEvery chargeback answered before the network deadline.Deadline close? Escalate. A missed deadline means the money is lost.L2 with disputes team

Golden rules

  • Never store or log full card numbers or security codes.
  • Every timeout needs a reversal.
  • Chargeback deadlines are hard deadlines.

Want the full picture, from building it to running it live? Read the Card Payments Runbook (Debit, Credit and Prepaid).

For forward deployed engineers (FDE)

As an FDE, you sit with the client and make the integration actually work. Here is your checklist for this rail.

First call with the clientIn store, online or both? Which networks and wallets (Apple Pay, Google Pay)? Who holds the card data (the tokenization provider)?
Set up and connectivityGateway credentials, terminal and merchant IDs, tokenization, 3-D Secure for online payments, and the settlement account.
Test and certifyApprovals, declines (05, 51), partial approvals, reversals after a timeout and refunds. Then terminal and host certification with the networks.
Go-live and hypercareStart with a few pilot stores or a small share of traffic. For the first few days, match approvals to settlement.
Where it usually breaksFull card numbers in logs (a PCI problem). No reversal sent after a timeout. A captured amount that differs from the approved amount.

The files on this rail

Each file below shows how it starts, what is inside, its status codes and a sample. For all the other files, see the full guide: how payment files are processed in US banks.

ISO 8583: card messages

In one line: Very short messages that ask “can this card pay?” and get an answer in about a second.

  • How it starts: the shopper taps or types in a card. The terminal or website sends a request through the merchant’s processor.
  • What is inside: a message type (0100 is a request, 0110 the answer, 0400 a reversal) and numbered data elements. For example, DE2 is the card number, DE4 the amount and DE39 the response code.
  • The money moves later, in daily clearing files such as Visa BASE II and Mastercard IPM.
Sample file: ISO 8583

Made-up data, shortened. Real files have more fields.

Authorization request  MTI 0100
DE2   PAN (card number)       4111 **** **** 1111   (never stored in clear)
DE3   Processing code        000000                (purchase)
DE4   Amount                 000000006400          ($64.00)
DE7   Transmission time      1120143522
DE11  Trace number (STAN)    004512
DE22  Entry mode             071                   (contactless chip)
DE41  Terminal ID            TRM00017
DE42  Merchant ID            MERCH0001234
DE49  Currency               840                   (USD)

Authorization response MTI 0110
DE38  Approval code          A1B2C3
DE39  Response code          00                    (00 = approved, 05 = do not honour, 51 = no funds)
Read more: ISO 8583

For tech teams, product owners and testers

For developersNever write full card numbers in logs. PCI DSS forbids it. If a request times out, send a reversal (0400) so the shopper is not charged twice.
For product ownersDecide what decline messages people see, whether you allow partial approvals, and how disputes are handled.
What to testA timeout followed by a reversal. A partial approval. DE39 codes 00, 05 and 51. A duplicate STAN (the trace number).

API (JSON): real-time requests

In one line: How apps and fintechs start payments one at a time, especially instant ones.

  • How it starts: someone presses “Pay” in an app, or a platform calls the bank’s API.
  • What is inside: JSON with the amount, the accounts, the payee and a reference. The headers carry the security token and an idempotency key (a unique ID that stops the same payment going twice).
  • What happens next: the bank runs the same internal steps as for a file. It replies quickly, then sends a webhook later with the final status.
Sample file: API (JSON)

Made-up data, shortened. Real files have more fields.

POST /v1/payments
Authorization: Bearer <OAuth token>
Idempotency-Key: 6f1c2a90-7b1e-4d3a-9c55-7e0d9e5b1a11
Content-Type: application/json

{
  "rail": "RTP",
  "amount": { "value": "1250.50", "currency": "USD" },
  "debtor_account": "1112223334",
  "creditor": { "name": "Acme Supplies Inc.", "aba": "123456780", "account": "9876543210" },
  "end_to_end_id": "INV-7781",
  "remittance": "Invoice INV-7781"
}

HTTP/1.1 202 Accepted
{ "payment_id": "pmt_8KQ2", "status": "PENDING", "end_to_end_id": "INV-7781" }

Webhook a few seconds later:
{ "event": "payment.settled", "payment_id": "pmt_8KQ2", "status": "COMPLETED",
  "network_reference": "8a562c67-ca16-48ba-b074-65581be6f001" }
Read more: API (JSON)

For tech teams, product owners and testers

For developersUse OAuth 2.0 and mutual TLS. Require an Idempotency-Key so a retry never pays twice. Reply with 202 (accepted), then send the final result by a signed webhook.
For product ownersAn API needs rate limits, a sandbox, versioning and clear error codes. Treat it as a product, not just a pipe.
What to testThe same Idempotency-Key sent twice. An expired token. A webhook that arrives twice or late. A timeout when the payment actually went through.

Read next

Sources: Federal Reserve Financial Services; The Clearing House; Nacha Operating Rules; Swift. Sample files are fictional and shortened.

Working on a payments project?

I help banks and fintechs deliver real-time payments, ISO 20022, and AI-driven AML and compliance change, from strategy to go-live.

Connect on LinkedInSee how I can help