Payments Training Hub
Request: (No request body. GET requests do not carry a body. The payment identification is in the URL path only: GET /v1/payments/PAY-20261105-8841/status)
Response: {
  "payment_id": "PAY-20261105-8841",
  "status": "ACSC",
  "status_description": "Settlement completed on the debtor's account. This does NOT confirm the beneficiary has been credited; that is ACCC.",
  "uetr": "4f8a2c1e-7b3d-4e9a-8c2f-1a5d6e7f8b90",
  "end_to_end_id": "INV-8841",
  "amount": 25000.0,
  "currency": "USD",
  "value_date": "2026-11-05",
  "history": [
    {
      "status": "ACCP",
      "time": "2026-11-05T09:12:00Z",
      "description": "Accepted for processing"
    },
    {
      "status": "ACSP",
      "time": "2026-11-05T09:14:00Z",
      "description": "Accepted, settlem

Returns the current status and tracking history for one payment. It shows each stage the payment has passed, in time order with the most recent stage last, and the latest status code. Use this to find out where a payment

0:00 / 2:19 Step 1 of 5

REST APIs for Payments

API Banking and Open Banking, Lesson 2 of 9, Narration 2:19, D10 APIs and integration

IdempotencyRetryAPI

What you will learn

Your objective. By the end of this lesson, you will be able to explain REST APIs for payments. Most modern payment APIs use REST, which is an architectural style built on standard HTTP methods and on resources that have clear identifiers.

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

  • Modern payment APIs use REST
  • To cancel
  • Without idempotency
  • Pagination and error handling
  • Error responses must be consistent

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...

Retry: Repeating a failed request or message delivery after a delay, usually with a limit on attempts and a back off period.

API: Application programming interface, a set of rules that lets one software system call another system to request data or trigger an action.

API request and response viewer showing REST APIs for Payments.

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

A fintech sends the same payment initiation request twice because its first call timed out. The bank processes it twice and the customer is debited twice. What control was missing?

Takeaway and next step

What to remember

A BA should review the error catalogue for an API as carefully as the success cases, because developers spend most of their integration time handling errors, not the happy path.

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 "From Files and SWIFT to Real Time APIs".

Transcript and full text

Show transcript

Most modern payment APIs use REST, which is an architectural style built on standard HTTP methods and on resources that have clear identifiers. A payment is a resource, an account is a resource, and a payment status is a resource, each with its own URL. To create a payment, a client sends a POST request to the payments resource with the payment details in the body. To check the status, the client sends a GET request to that payment's URL. To cancel a payment that has not yet been released, the client might send a DELETE or a PATCH request. This consistency is the main strength of REST, because a developer who has used one REST API can understand another one quickly, and standard tools can test and monitor them. Idempotency is the most important payment specific concern in REST API design. Networks fail, and when a client does not receive a response, it does not know whether the payment was created or not, so it will retry. Without idempotency, the retry creates a second payment, and the customer is charged twice. The solution is an idempotency key, a unique value the client sends with the creation request, which the bank stores alongside the payment. If the same key arrives again, the bank returns the original result instead of creating a new payment. A BA writing API requirements must insist on idempotency for every operation that moves money, and must define how long keys are retained and what happens when a key is reused with different payment details. Versioning, pagination and error handling are the other essentials. APIs change over time, and versioning, usually in the URL or in a header, lets the bank improve the API without breaking existing clients. Pagination controls how large lists, such as transaction histories, are returned, so that a client asking for a year's transactions does not receive a single enormous response. Error responses must be consistent and useful, with a machine readable code, a human readable message, and enough detail for the developer to fix the problem, without leaking sensitive information. A BA should review the error catalogue for an API as carefully as the success cases, because developers spend most of their integration time handling errors, not the happy path. A worked example shows a REST call end to end. A corporate treasury system creates a payment of EUR 25,000 to a supplier. It sends POST /v1/payments with a JSON body containing the debtor account, the creditor account, the amount, and an Idempotency-Key header with a UUID. The bank returns 202 Accepted with a payment identifier PAY-20261105-8841 and a status ACCP. The treasury system then calls GET /v1/payments/PAY-20261105-8841/status every 30 seconds until the status changes to ACCC, which confirms the beneficiary was credited. The whole flow takes 8 seconds for a SEPA Instant payment, or up to one business day for a standard SEPA credit transfer. The treasury system stores the payment identifier and the idempotency key, so that if the network times out on the POST, it can safely retry with the same key and receive the same payment identifier back, instead of creating a duplicate payment. A failure scenario tests the error handling. The treasury system sends a payment with a creditor account number that is missing a digit. The bank returns 422 Unprocessable Content with a business error code AC01 and a field path creditorAccount.iban, and a message stating the account number is invalid. The treasury system logs the error, alerts the operator, and does not retry, because retrying the same invalid request will fail again. The operator corrects the account number and resubmits with a new idempotency key, because the instruction has changed. A client that retries a 422 error with the same body is wasting its rate limit; a client that retries a 500 error without an idempotency key is creating a duplicate. For a business analyst, the requirement is to define the error code for each failure, the HTTP status, and the client behaviour for each, and to test each with a real call. Last reviewed 7 November 2026. Further reading: Berlin Group NextGenPSD2 API framework; ISO 20022 ExternalPaymentTransactionStatus1Code. Take a payment initiation through a REST API. The client sends POST /v1/payments with a JSON body containing the debtor account, the creditor account, the amount of EUR 5,000, and an idempotency key. The bank returns 202 Accepted with a payment identifier and a status of ACCP. The client then sends GET /v1/payments/{id}/status and receives ACCC when the payment has settled. If the client sends the same POST again with the same key, the bank returns the original 202 response, not a new payment. If the amount in the body is invalid, the bank returns 400 Bad Request with a machine readable code and a human readable message. Each of these steps is a test case, and the BA should write all of them. Versioning failures are common and expensive. Suppose the bank releases v2 of its payments API with a new mandatory field, and a corporate client still on v1 sends a payment without it. The bank must either reject the payment with a clear error, which breaks the client's integration, or accept it and fill the field with a default, which may be wrong. The right approach is to version in the URL, to keep v1 working until its published sunset date, and to tell clients a year in advance. A BA should specify the versioning policy, the sunset notice period, and the behaviour when a client calls a retired version, because a retired version that still accepts payments is a security risk. The error catalogue is the most important part of an API specification, and the BA should review it line by line. Each error needs a status code, a business code, a message, and the action the client should take. A 400 means the request was wrong, a 401 means the token is invalid, a 409 means the payment already exists, a 422 means a business rule failed, and a 429 means the client is calling too fast. The BA should also define the support process: when a developer gets an error they do not understand, who do they call, and how quickly do they get an answer. An API with a good error catalogue and a good support process is adopted; an API without them is abandoned.

Most modern payment APIs use REST, which is an architectural style built on standard HTTP methods and on resources that have clear identifiers. A payment is a resource, an account is a resource, and a payment status is a resource, each with its own URL. To create a payment, a client sends a POST request to the payments resource with the payment details in the body. To check the status, the client sends a GET request to that payment's URL. To cancel a payment that has not yet been released, the client might send a DELETE or a PATCH request. This consistency is the main strength of REST, because a developer who has used one REST API can understand another one quickly, and standard tools can test and monitor them.

Idempotency is the most important payment specific concern in REST API design. Networks fail, and when a client does not receive a response, it does not know whether the payment was created or not, so it will retry. Without idempotency, the retry creates a second payment, and the customer is charged twice. The solution is an idempotency key, a unique value the client sends with the creation request, which the bank stores alongside the payment. If the same key arrives again, the bank returns the original result instead of creating a new payment. A BA writing API requirements must insist on idempotency for every operation that moves money, and must define how long keys are retained and what happens when a key is reused with different payment details.

Versioning, pagination and error handling are the other essentials. APIs change over time, and versioning, usually in the URL or in a header, lets the bank improve the API without breaking existing clients. Pagination controls how large lists, such as transaction histories, are returned, so that a client asking for a year's transactions does not receive a single enormous response. Error responses must be consistent and useful, with a machine readable code, a human readable message, and enough detail for the developer to fix the problem, without leaking sensitive information. A BA should review the error catalogue for an API as carefully as the success cases, because developers spend most of their integration time handling errors, not the happy path.

A worked example shows a REST call end to end. A corporate treasury system creates a payment of EUR 25,000 to a supplier. It sends POST /v1/payments with a JSON body containing the debtor account, the creditor account, the amount, and an Idempotency-Key header with a UUID. The bank returns 202 Accepted with a payment identifier PAY-20261105-8841 and a status ACCP. The treasury system then calls GET /v1/payments/PAY-20261105-8841/status every 30 seconds until the status changes to ACCC, which confirms the beneficiary was credited. The whole flow takes 8 seconds for a SEPA Instant payment, or up to one business day for a standard SEPA credit transfer. The treasury system stores the payment identifier and the idempotency key, so that if the network times out on the POST, it can safely retry with the same key and receive the same payment identifier back, instead of creating a duplicate payment.

A failure scenario tests the error handling. The treasury system sends a payment with a creditor account number that is missing a digit. The bank returns 422 Unprocessable Content with a business error code AC01 and a field path creditorAccount.iban, and a message stating the account number is invalid. The treasury system logs the error, alerts the operator, and does not retry, because retrying the same invalid request will fail again. The operator corrects the account number and resubmits with a new idempotency key, because the instruction has changed. A client that retries a 422 error with the same body is wasting its rate limit; a client that retries a 500 error without an idempotency key is creating a duplicate. For a business analyst, the requirement is to define the error code for each failure, the HTTP status, and the client behaviour for each, and to test each with a real call. Last reviewed 7 November 2026. Further reading: Berlin Group NextGenPSD2 API framework; ISO 20022 ExternalPaymentTransactionStatus1Code.

Take a payment initiation through a REST API. The client sends POST /v1/payments with a JSON body containing the debtor account, the creditor account, the amount of EUR 5,000, and an idempotency key. The bank returns 202 Accepted with a payment identifier and a status of ACCP. The client then sends GET /v1/payments/{id}/status and receives ACCC when the payment has settled. If the client sends the same POST again with the same key, the bank returns the original 202 response, not a new payment. If the amount in the body is invalid, the bank returns 400 Bad Request with a machine readable code and a human readable message. Each of these steps is a test case, and the BA should write all of them.

Versioning failures are common and expensive. Suppose the bank releases v2 of its payments API with a new mandatory field, and a corporate client still on v1 sends a payment without it. The bank must either reject the payment with a clear error, which breaks the client's integration, or accept it and fill the field with a default, which may be wrong. The right approach is to version in the URL, to keep v1 working until its published sunset date, and to tell clients a year in advance. A BA should specify the versioning policy, the sunset notice period, and the behaviour when a client calls a retired version, because a retired version that still accepts payments is a security risk.

The error catalogue is the most important part of an API specification, and the BA should review it line by line. Each error needs a status code, a business code, a message, and the action the client should take. A 400 means the request was wrong, a 401 means the token is invalid, a 409 means the payment already exists, a 422 means a business rule failed, and a 429 means the client is calling too fast. The BA should also define the support process: when a developer gets an error they do not understand, who do they call, and how quickly do they get an answer. An API with a good error catalogue and a good support process is adopted; an API without them is abandoned.

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.