Sobes.tech
Middle+

5. Payment reliability: "How was the issue of idempotency solved in gRPC?" Interviewer’s goal: Payments — the most dangerous area for duplicates (Double Spending). Possible question: "The payment request went through gRPC but failed due to timeout (DEADLINE_EXCEEDED). Did the money get deducted — unknown. What does the payment module do?" How to answer: "In a financial transactional context, any repeated request must have an Idempotency Key: 1. In the metadata of the gRPC request (metadata=((‘x-idempotency-key’, key_uuid),)) we always transmitted a unique transaction key. 2. When receiving DEADLINE_EXCEEDED, the client could safely Retry with the same key. 3. The acquiring service checked the presence of this key in its database / Redis and either returned the status of the already processed transaction or processed it for the first time."