Lesson 4 of 16
45. Design a Payment System (Stripe / UPI)

45.3 What are the doors?

3 min read+10 XP

Step 3: API and data model (10 minutes)

POST /v1/payment_intents Idempotency-Key: order-881 body: { "amount": 124800, "currency": "INR", "merchant": "m_bookstore", "method": "upi" | "card_token" } returns: 201 { "id": "pi_1", "status": "requires_action" | "processing" | "succeeded" | "failed" } POST /v1/refunds Idempotency-Key: refund-881-1 { "payment_intent": "pi_1", "amount": 124800 } GET /v1/payment_intents/{id} → current status (merchants can poll; webhooks are preferred) (webhook to merchant) POST https://merchant…/webhooks signed: payment_intent.succeeded, .failed, refund.succeeded (callback from bank) POST /internal/bank/callback signed by the bank or network

Amounts are integers in the smallest unit (paise), never floats.