Make Cross-Border Payment Creation Idempotent With Client Keys

Last updated: November 29, 2026

Quick Overview

Implement a payment-creation endpoint for bank clients that accepts an idempotency key, so a retried request with the same key and body returns the original response without moving money twice, while reuse of a key with a different body is rejected.

Ripple
Software Engineering Fundamentals
Software Engineer
Ripple
November 29, 2026
Software Engineer
Technical Screen
Software Engineering Fundamentals
Easy

0

0

0 solved


Implement a payment-creation endpoint for bank clients that accepts an idempotency key, so a retried request with the same key and body returns the original response without moving money twice, while reuse of a key with a different body is rejected.

Ripple Payments customers are banks and payment providers whose integrations retry on timeouts, and a double payout in a remittance corridor is real money that is hard to claw back. The interviewer wants to see that you treat idempotency as part of the API contract, scope keys per client, and think about expiry and concurrent retries.

What the Interviewer Expects
  • Scope keys by client, not globally
  • Fingerprint the request body so key reuse with a different payload is detected
  • Return the stored original response on replay
  • Give keys a TTL and explain the trade-off
  • Discuss the in-flight race when two retries arrive at once
Key Topics to Cover
Idempotency
API Design
Retries
Request Fingerprinting
Exactly-Once Semantics
How to Approach This
  1. Apply SOLID principles. Single Responsibility makes code testable, Open/Closed makes it extensible.
  2. Choose data structures based on access patterns, not familiarity.
  3. Prefer immutable data and message passing over shared mutable state for concurrency.
  4. Design APIs with RESTful conventions, versioning, meaningful errors, and pagination from day one.
Possible Follow-up Questions
  • How would you implement this across many API instances backed by Postgres?
  • What should a replay return if the original request is still processing?
  • Should a failed request (for example a validation error) be cached under its key?
  • How does this relate to the ledger's own replay protection via sequence numbers?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Practice System Design Problems
Sample Answer
Requirements

create_payment(client_id, idem_key, body) must execute the payment at most once per (client_id, idem_key) within a retention window (24 hours is typical). A replay with the same body returns the i...

High-Level Design

Store (client_id, key) -> (fingerprint, response, expires_at). The fingerprint is a hash of the canonicalised body (sorted JSON keys) so field order does not matter. On a hit that has not expired, c...


Submit Your Answer
Markdown supported

Related Questions