Payments Training Hub
Request: {
  "debtor_name": "Northgate Trading Ltd",
  "debtor_account": "GB29NWBK60161331926819",
  "debtor_agent_bic": "NWBKGB2L",
  "creditor_name": "Tanaka Trading Pte Ltd",
  "creditor_address": {
    "street": "1 Harbourfront Avenue",
    "town": "Singapore",
    "postcode": "098633",
    "country": "SG"
  },
  "creditor_account": {
    "bank_name": "DBS Bank Ltd, Singapore",
    "bank_code": "7171",
    "branch_code": "001",
    "account_number": "1234567",
    "note": "Singapore has no IBAN. Singapore accounts are identified by bank code + branch code + account number, not by IBAN."
  },
  "cre
Response: {
  "payment_id": "PAY-20261105-8841",
  "status": "ACCP",
  "status_description": "Accepted for processing: technical validation and customer profile checks passed. Settlement has not started.",
  "uetr": "4f8a2c1e-7b3d-4e9a-8c2f-1a5d6e7f8b90",
  "end_to_end_id": "INV-8841",
  "value_date": "2026-11-05",
  "created_at": "2026-11-05T09:12:00Z",
  "request_id": "REQ-20261105-0001",
  "estimated_charges": {
    "amount": 42.0,
    "currency": "USD",
    "breakdown": [
      {
        "description": "First correspondent charge",
        "amount": 20.0
      },
      {
        "description": "Seco

Creates a new customer credit transfer instruction. The caller supplies debtor, creditor, amount, currency and value date, and the API returns a payment identification that can be used to track the payment. The response

0:00 / 3:47 Step 1 of 5

System design deep dive: payment APIs at scale

API Banking and Open Banking, Lesson 8 of 9, Narration 3:47, D10 APIs and integration

IdempotencyGatewayWebhook

What you will learn

Your objective. By the end of this lesson, you will be able to explain system design deep dive: payment APIs at scale. The API gateway is the front door for all payment APIs, and it handles routing, security, and traffic management before any request reaches a backend service.

Why it matters. This matters because APIs and integrations are how systems talk to each other. A badly specified API is a failed payment, a duplicate, or a security hole.

Chapter objective: Learner explains API banking and open banking, including consent, authentication, and third-party access, and writes API requirements for a payment initiation use case. Learner demonstrates this skill using realistic banking examples, explaining each step clearly and using correct terminology throughout.

Key learning points

  • API gateway
  • Authentication for payment APIs uses OAuth
  • Rate limiting
  • Idempotency keys make payment APIs safe
  • Webhook delivery and versioning keep clients

Key terms

Idempotency: The property that repeating the same request has the same effect as sending it once. In payments, an idempotency key lets a client safely retry a request after a timeout without creating a duplicate...

Gateway: A service that connects a merchant website or app to payment networks and acquirers. It encrypts card data, routes authorisation requests, and returns the result to the merchant.

Webhook: A method where a server sends an event notification to a client system as soon as something happens, instead of the client polling for updates.

API request and response viewer showing System design deep dive: payment APIs at scale.

Insights and practice scenarios

Worked insights and practice scenarios for this lesson. Each one is a reusable PaymentForge case, so the same case may appear in more than one lesson.

Practise this lesson

Exercise

Write the request and the expected response for the API call described in this lesson.

Use the API resources, operations and fields named in this lesson.

  1. What to do. Write the JSON request with the required fields, the success response, and one error response with its error code.

Correct result. A correct request has all mandatory fields, a valid idempotency key, and the right resource and operation. The success response confirms acceptance, and the error response names the field or rule that failed.

Why. An API contract is a promise between two systems. If the request is wrong, the API must reject it cleanly, not fail silently.

Check your understanding

Practice question

Which of the following best describes system design deep dive: payment APIs at scale?

Takeaway and next step

What to remember

Every API call is written to an audit log with the client, the endpoint, the timestamp, the request identifier, and the outcome, and the log is retained for at least seven years.

Call the API described in this lesson with a valid request, then with a missing field, and compare the responses.

Open the API Playground →

Builds on "Payment Initiation and the Developer Experience".

Transcript and full text

Show transcript

The API gateway is the front door for all payment APIs, and it handles routing, security, and traffic management before any request reaches a backend service. A request arrives at the gateway, which validates the token, checks the rate limit, logs the call, and routes it to the correct service based on the path and version. The gateway runs as a cluster of stateless nodes behind a load balancer, so it scales by adding nodes, and a large bank's gateway handles 10,000 to 20,000 API calls per second at peak. The gateway also terminates TLS, enforces request size limits, and blocks malformed requests early, so backend services only see clean, authenticated traffic and can focus on payment processing. Authentication for payment APIs uses OAuth 2.0 for customer facing access and mutual TLS for partner and corporate access. With OAuth, a client obtains a short lived access token, typically valid for 15 to 60 minutes, and presents it with each request, while refresh tokens allow long lived sessions without storing passwords. With mutual TLS, both the client and the server present certificates, so the bank knows exactly which system is calling, and certificates are rotated at least once a year. Every API key and certificate is tied to a specific client and a specific set of permissions, so a client that can read account balances cannot also initiate payments unless it has been explicitly granted that scope. Rate limiting protects the platform from overload and from abuse. Limits are set per client, per API, and per endpoint, for example 100 requests per second for payment initiation and 1,000 per second for balance queries, with a burst allowance of 20 percent above the steady rate. When a client exceeds its limit, the gateway returns a 429 response with a retry after header, and the client is expected to back off rather than retry immediately. Limits are enforced in a distributed store so they work correctly across all gateway nodes, and they are reviewed monthly against actual usage. A client that repeatedly exceeds its limit is contacted by the API team, because sustained overuse usually means a bug or a misunderstanding rather than malice. Idempotency keys make payment APIs safe to retry. When a client creates a payment, it sends a unique idempotency key with the request, and the bank stores that key with the payment record. If the same key arrives again, whether because the first response was lost or the client retried too quickly, the bank returns the original result instead of creating a second payment. Keys are stored for at least 24 hours, and often for seven days, so retries over a weekend are still safe. This simple mechanism prevents the most expensive API failure, a duplicate payment, and it is a requirement for any production payment API, not an optional extra. Webhook delivery and versioning keep clients informed without polling. When a payment changes state, the bank sends a webhook event to the client's registered URL, with a signed payload so the client can verify it came from the bank. If delivery fails, the bank retries with exponential backoff, for example after 1 minute, 5 minutes, 15 minutes, and 1 hour, for up to 24 hours, and then moves the event to a dead letter queue for manual review. API versioning uses the URL path, such as v1 and v2, so old clients keep working while new clients adopt new features. Every API call is written to an audit log with the client, the endpoint, the timestamp, the request identifier, and the outcome, and the log is retained for at least seven years.

The API gateway is the front door for all payment APIs, and it handles routing, security, and traffic management before any request reaches a backend service. A request arrives at the gateway, which validates the token, checks the rate limit, logs the call, and routes it to the correct service based on the path and version. The gateway runs as a cluster of stateless nodes behind a load balancer, so it scales by adding nodes, and a large bank's gateway handles 10,000 to 20,000 API calls per second at peak. The gateway also terminates TLS, enforces request size limits, and blocks malformed requests early, so backend services only see clean, authenticated traffic and can focus on payment processing.

Authentication for payment APIs uses OAuth 2.0 for customer facing access and mutual TLS for partner and corporate access. With OAuth, a client obtains a short lived access token, typically valid for 15 to 60 minutes, and presents it with each request, while refresh tokens allow long lived sessions without storing passwords. With mutual TLS, both the client and the server present certificates, so the bank knows exactly which system is calling, and certificates are rotated at least once a year. Every API key and certificate is tied to a specific client and a specific set of permissions, so a client that can read account balances cannot also initiate payments unless it has been explicitly granted that scope.

Rate limiting protects the platform from overload and from abuse. Limits are set per client, per API, and per endpoint, for example 100 requests per second for payment initiation and 1,000 per second for balance queries, with a burst allowance of 20 percent above the steady rate. When a client exceeds its limit, the gateway returns a 429 response with a retry after header, and the client is expected to back off rather than retry immediately. Limits are enforced in a distributed store so they work correctly across all gateway nodes, and they are reviewed monthly against actual usage. A client that repeatedly exceeds its limit is contacted by the API team, because sustained overuse usually means a bug or a misunderstanding rather than malice.

Idempotency keys make payment APIs safe to retry. When a client creates a payment, it sends a unique idempotency key with the request, and the bank stores that key with the payment record. If the same key arrives again, whether because the first response was lost or the client retried too quickly, the bank returns the original result instead of creating a second payment. Keys are stored for at least 24 hours, and often for seven days, so retries over a weekend are still safe. This simple mechanism prevents the most expensive API failure, a duplicate payment, and it is a requirement for any production payment API, not an optional extra.

Webhook delivery and versioning keep clients informed without polling. When a payment changes state, the bank sends a webhook event to the client's registered URL, with a signed payload so the client can verify it came from the bank. If delivery fails, the bank retries with exponential backoff, for example after 1 minute, 5 minutes, 15 minutes, and 1 hour, for up to 24 hours, and then moves the event to a dead letter queue for manual review. API versioning uses the URL path, such as v1 and v2, so old clients keep working while new clients adopt new features. Every API call is written to an audit log with the client, the endpoint, the timestamp, the request identifier, and the outcome, and the log is retained for at least seven years.

Full lesson text (all scenes)

Completing a lesson updates your progress dashboard on the homepage.

Scene timestamps are estimated by allocating the narration text proportionally across the real audio length. The audio playback position is the source of truth: pause freezes the visual, seeking restores the correct scene, replay restarts the scene animation.