Secure Banking API Development, Part 2: Make the Controls Work at Every Hop
Follow a transfer request through implementation, from gateway identity checks to release approval, credential rotation and verification.
Perspectives · Secure Banking API Development · Part 2
A mobile app sends a transfer request through the bank’s API gateway. The token is valid, the request matches the schema, and the service connection is encrypted. The transfer should still be rejected if the caller cannot debit that account, or if the payment details differ from what was approved. Those decisions belong in the systems that know the account, the approval and the current state of the transaction.
Part 1 covered the decisions to make before writing code: who can initiate a transfer, what the API promises, and what happens when a call fails. Part 2 takes the same transfer through implementation, from the first line of the API contract to the release checks the bank should require.
1. Turn the contract into checks the pipeline can run
Put the request, response and error schemas under version control with the code. Define which fields are required, which the caller may set, and what the service returns at each stage. For example, a client can supply a payee reference and an amount in an agreed representation. The service derives the initiating identity from trusted credentials and retrieves approval status from its own records. A client-supplied field such as approved=true must never change who is allowed to release funds.
Run contract tests and compatibility checks when the API changes. Test old supported clients, reject unsupported media types and ambiguous inputs, and cap request size before parsing. A valid schema tells you the amount is well formed. It takes a business check to establish whether the amount, currency, account and beneficiary are permitted for this instruction.
2. Carry a trustworthy identity through the request path
At the gateway, verify the token signature against the expected issuer’s keys and allowed algorithms. Enforce the expected issuer, audience and expiry. A token issued for a balance enquiry should not work at a transfer endpoint. For a customer request, retain the verified customer identity and the application acting for that customer. For a batch or partner integration, use a dedicated workload identity and give it only the operations it needs. Keep credentials distinct across environments and integrations.
Strip incoming headers that claim to carry trusted identity, roles or approval context. If the gateway passes identity downstream, do it over an authenticated path using a mechanism the receiving service can verify. Restrict alternate ingress so a caller cannot bypass that check. Where mutual TLS is used, be clear about what it proves: it authenticates the peer on that connection. If the design uses certificate-bound OAuth access tokens, the resource server must also verify that the token is bound to the certificate presented by the caller. Plan how that proof reaches the enforcement point if TLS terminates upstream. See RFC 9700 and RFC 8705.
3. Enforce account, operation and field permissions in the service
The gateway can reject a request with no transfer scope. The transfer service must still establish that this caller can debit this account, use this beneficiary and perform this operation now. A service permitted to create an instruction may have no authority to approve, release or cancel it. Apply the same checks to reads: knowing a transfer reference must never let a caller retrieve another customer’s payment details.
Where maker-checker applies, bind the approval to the specific instruction version and the terms the checker saw: debit account, beneficiary, amount and currency. A change to any approved term must invalidate the approval. At release, verify the instruction version and current approval state at the point that commits the state change. If another system posts the debit, enforce the relevant posting rules at that boundary too. A check made earlier in the workflow does not guarantee the instruction remains valid when money moves.
4. Build for key rotation, safe errors and investigation
Issue credentials through a managed vault or workload identity platform. Keep secrets out of source, build artifacts, configuration exports and logs. Rehearse emergency revocation and routine rotation across primary and recovery environments; a standby route still accepting a revoked credential is a live exposure.
Give callers stable error codes and a correlation reference. Keep internal details out of the response: no stack traces, tokens, full account numbers or sensitive payloads. Record enough in protected audit logs to reconstruct the decision: the authenticated actor and client, the instruction reference, the rule outcome and the downstream reference. Keep response states honest. If the API returns 202 Accepted, the client needs a way to learn what happened next; acceptance does not mean the account was debited or settlement completed. See RFC 9110 and RFC 9457.
5. Prove the controls before release
| Release test | Expected evidence |
|---|---|
| A valid token for a different API is sent to the transfer route. | The request is rejected before the transfer service acts. |
| A caller changes the debit account ID or supplies a forged identity header. | Verified identity drives the decision; no unauthorised account data or posting is produced. |
| The beneficiary changes after maker-checker approval. | The original approval cannot release the modified instruction. |
| A revoked credential is tested after failover. | The recovery route rejects it and generates a traceable security event. |
| The downstream service times out after receiving a transfer request. | The API exposes a pending or uncertain outcome, and a retry cannot silently create a second payment. |
Capture these results in the release record with a named owner for each control. Use the OWASP API Security Top 10 to challenge what the suite misses, especially authorisation by object, property and function. Part 3 will follow the transfer beyond the request: what to do when the debit may have posted, the response was lost, and the bank still has to establish the outcome.
Continue with Learning
Approving a moving target. Test whether a payment approval still applies when the instruction changes.
Put this perspective into practice.
Explore the concepts, make a decision and test what changes when the situation changes.
Topics: API Architecture, Banking Architecture, Inside the Banking Backbone, Operational Resilience, Perspective