Use a computer

For full performance and fluidity, please open Pay Engineers on a desktop or laptop. On mobile, the experience is limited — especially authenticated sections and advanced tools after login.

Engineering

API design principles for merchant integrations

Resource naming, signed webhooks and genuinely usable sandbox credentials do more to reduce support load than any amount of documentation polish. We cover the painful integration paths — partial captures, late refunds, disputed chargebacks — that separate great payment APIs from merely functional ones.

Jul 6, 2026 5 min 1,083 0

Merchants integrating a payment API are rarely payments specialists themselves — they are e-commerce developers, platform engineers or agency contractors under deadline pressure, trying to get checkout working correctly with minimal domain-specific knowledge. Every point of ambiguity in your API design becomes, multiplied across your entire merchant base, a predictable and recurring support ticket. Merchants abandon APIs that feel clever instead of clear far more often than they abandon APIs that feel merely unglamorous but reliable.

Predictable resources beat clever abstractions

Payment APIs benefit enormously from conventional, boring resource design: nouns that map directly to real-world concepts (payments, refunds, disputes, payouts), consistent pagination and filtering patterns across every resource, and predictable status enumerations that do not require reading source code to understand. Clever abstractions that try to unify conceptually different operations under one flexible endpoint tend to save engineering effort on your side while costing every integrating merchant comprehension effort on theirs.

Explicit error codes over generic failures

A generic "400 Bad Request" with no further detail forces every integrating developer to either guess or contact support. Explicit, documented error codes — distinguishing an invalid card number from an expired card from insufficient funds from a risk-engine decline — let merchants build correct handling logic themselves, and let their own customer-facing error messages be genuinely helpful rather than generic.

Signed webhooks are a security requirement, not an option

Webhooks that are not cryptographically signed invite a real security risk: anyone who discovers or guesses a merchant's webhook endpoint URL can inject fake payment confirmation events. Every webhook payload should carry a signature that the receiving merchant can verify against a shared secret, with clear documentation and example code for verification in multiple common languages, not just a one-line mention buried in an appendix.

Sandbox ergonomics matter more than they get credit for

A sandbox environment that behaves meaningfully differently from production — different error rates, missing edge cases, unrealistic instant settlement — teaches merchants incorrect assumptions that surface as production bugs. First-class sandbox credentials, provisioned instantly without a sales conversation, and test scenarios that can deliberately trigger declines, disputes and partial failures, let merchants build genuinely correct integrations before they ever touch real money.

Publish OpenAPI specifications and keep them truthful

A published OpenAPI specification is only valuable if it is generated from, or continuously validated against, the actual API behaviour. A specification that drifts from reality — documenting a field that no longer exists, or omitting one that was added — is worse than no specification, because it actively misleads integrating developers who reasonably trust it.

Documenting the painful integration paths

Support load correlates directly with ambiguity, and the highest-ambiguity paths in any payment API are rarely the happy path. Partial captures — capturing less than the originally authorised amount — need explicit documentation of what happens to the remaining authorised balance. Refunds attempted after a transaction has already settled behave differently from refunds before settlement, and merchants need to know which rules apply when. 3DS challenge flows have multiple failure and retry paths that need worked examples, not just a sequence diagram of the happy path. Disputed chargebacks need clear documentation of the evidence submission process and realistic timelines, since merchants handling their first chargeback are often anxious and need clarity more than brevity.

An API design checklist

  • Use predictable, conventional resource naming rather than clever unified abstractions.
  • Publish explicit, documented error codes distinguishing every meaningfully different failure reason.
  • Sign every webhook payload and provide verification example code in multiple languages.
  • Provision first-class sandbox credentials instantly, with deliberate failure and dispute scenarios available.
  • Keep OpenAPI specifications continuously validated against actual API behaviour, not just published once.
  • Document partial captures, late refunds, 3DS retries and chargeback evidence flows with worked examples.

Great payment APIs are a competitive advantage precisely because they are also a support cost reducer — the two are the same investment.

Versioning without breaking existing integrations

Payment APIs live for years, integrated deeply into merchant systems that are not revisited often once working. A versioning strategy needs to let you evolve the API — adding fields, refining error codes, supporting new payment methods — without forcing every existing merchant into a disruptive migration on your timeline rather than theirs. Additive changes (new optional fields, new endpoints) can usually ship without a version bump; anything that changes existing behaviour should go through an explicit, well-communicated version transition with a generous deprecation window.

Maintain genuinely supported previous versions for long enough that merchants with limited engineering capacity have a realistic path to migrate, and be transparent about deprecation timelines well in advance rather than announcing a sunset date with only a few weeks' notice. Merchant trust in your API's stability is built over years and can be damaged quickly by a rushed, poorly communicated breaking change.

Key takeaways

  • Predictable, conventional API design reduces integration errors more than clever abstractions.
  • Explicit error codes and signed webhooks are baseline requirements, not advanced features.
  • Sandbox environments should closely mirror production behaviour, including deliberate failure scenarios.
  • Keep published API specifications continuously truthful against actual behaviour.
  • Invest documentation effort specifically in the painful paths: partial captures, late refunds, disputes.

Comments

0 comments

Sign in to leave a comment.

Entrar

No comments yet. Be the first to comment.

Keep reading

Related articles

More content that may interest you

View all posts
Featured
Engineering

Event-driven settlement pipelines that finance can trust

From authorisation events to books-ready settlement figures, finance teams need deterministic, replayable pipelines rather than eventual-consistency folklore. We explain how explicit batches, checksum reconciliation and human exception workbenches turn month-end from a fire drill into a routine.

18/07/2026 5 min 3,751 0
Engineering

Observability for payment systems

Infrastructure metrics alone consistently miss payment reality: authorisation rates by BIN country, 3DS challenge success and settlement file freshness tell a very different story than CPU graphs. We explain how to trace across acquirer dependencies and alert on customer impact instead of noise.

02/07/2026 5 min 2,721 0
Engineering

Migrating between PSPs without a big-bang cutover

Big-bang PSP cutovers are how outages happen, and traffic-shifting migrations with clear rollback plans consistently outperform weekend deploys. We explain dual-running, cohort-based migration and the credential isolation that keeps a provider switch low-drama for merchants.

27/06/2026 5 min 412 0