{"openapi":"3.1.0","info":{"title":"Hisab Pay API","version":"1.0.0","description":"Verify Telebirr, CBE and CBE Birr payments against the official receipts, and take payments through hosted checkout pages. Guide: https://pay.cassiacode.com/docs"},"servers":[{"url":"https://pay.cassiacode.com"}],"security":[{"bearer":[]}],"paths":{"/v1/me":{"get":{"summary":"Test your API key","operationId":"getMe","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"object":{"const":"key"},"livemode":{"type":"boolean"},"business":{"type":"string"}}}}}},"401":{"description":"invalid_key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/verify":{"post":{"summary":"Check a transaction against the official receipt","operationId":"verify","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/VerifyRequest"}}}},"responses":{"200":{"description":"The check (any outcome: see status)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Check"}}}},"400":{"description":"invalid_request, invalid_reference, test_reference, live_reference","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"invalid_key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"recipient_not_found, not_found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"no_accounts, not_pending, not_refundable, refund_too_large","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"rate_limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"internal_error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"bank_unavailable, unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/checks/{id}":{"get":{"summary":"Get a check again","operationId":"getCheck","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Check"}}}},"401":{"description":"invalid_key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"recipient_not_found, not_found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/payments":{"post":{"summary":"Create a payment with a checkout page","operationId":"createPayment","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreatePaymentRequest"}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Payment"}}}},"400":{"description":"invalid_request, invalid_reference, test_reference, live_reference","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"invalid_key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"recipient_not_found, not_found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"internal_error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"get":{"summary":"List payments (newest first)","operationId":"listPayments","parameters":[{"name":"status","in":"query","schema":{"type":"string","enum":["pending","paid","expired","canceled"]}},{"name":"order_id","in":"query","schema":{"type":"string"}},{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":100,"default":20}},{"name":"before","in":"query","description":"A created_at from the previous page","schema":{"type":"string","format":"date-time"}},{"name":"paid_since","in":"query","description":"Paid payments paid at or after this time, oldest paid first (for syncing into your books)","schema":{"type":"string","format":"date-time"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"object":{"const":"list"},"data":{"type":"array","items":{"$ref":"#/components/schemas/Payment"}},"has_more":{"type":"boolean"}}}}}},"400":{"description":"invalid_request, invalid_reference, test_reference, live_reference","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"invalid_key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/payments/{id}":{"get":{"summary":"Get a payment","operationId":"getPayment","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Payment"}}}},"401":{"description":"invalid_key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"recipient_not_found, not_found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/payments/{id}/cancel":{"post":{"summary":"Cancel a pending payment","operationId":"cancelPayment","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Payment"}}}},"401":{"description":"invalid_key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"recipient_not_found, not_found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"no_accounts, not_pending, not_refundable, refund_too_large","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/payments/{id}/refunds":{"post":{"summary":"Refund a paid payment (creates a refund payout to send and confirm)","operationId":"createRefund","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"amount":{"oneOf":[{"type":"number","minimum":0.01},{"type":"string","pattern":"^[\\d,]+(\\.\\d{1,2})?$"}],"description":"Birr: 1500, 19.99 or \"1,500.50\""},"method":{"type":"string","enum":["telebirr","cbe","cbe_birr"]},"account":{"type":"string"},"name":{"type":"string","maxLength":120},"description":{"type":"string","maxLength":200},"external_id":{"type":"string","pattern":"^[A-Za-z0-9._:-]{1,100}$"}}}}}},"responses":{"200":{"description":"Already created with this external_id","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Payout"}}}},"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Payout"}}}},"400":{"description":"invalid_request, invalid_reference, test_reference, live_reference","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"invalid_key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"recipient_not_found, not_found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"no_accounts, not_pending, not_refundable, refund_too_large","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/payouts":{"post":{"summary":"Create a payout (money you will send)","operationId":"createPayout","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreatePayoutRequest"}}}},"responses":{"200":{"description":"Already created with this external_id","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Payout"}}}},"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Payout"}}}},"400":{"description":"invalid_request, invalid_reference, test_reference, live_reference","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"invalid_key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"recipient_not_found, not_found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"no_accounts, not_pending, not_refundable, refund_too_large","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"internal_error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"get":{"summary":"List payouts (newest first)","operationId":"listPayouts","parameters":[{"name":"status","in":"query","schema":{"type":"string","enum":["pending","paid","canceled"]}},{"name":"external_id","in":"query","schema":{"type":"string"}},{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":100,"default":20}},{"name":"before","in":"query","schema":{"type":"string","format":"date-time"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"object":{"const":"list"},"data":{"type":"array","items":{"$ref":"#/components/schemas/Payout"}},"has_more":{"type":"boolean"}}}}}},"400":{"description":"invalid_request, invalid_reference, test_reference, live_reference","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"invalid_key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/payouts/{id}":{"get":{"summary":"Get a payout","operationId":"getPayout","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Payout"}}}},"401":{"description":"invalid_key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"recipient_not_found, not_found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/payouts/{id}/confirm":{"post":{"summary":"Confirm a payout with the transaction ID of your transfer","operationId":"confirmPayout","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["reference"],"properties":{"reference":{"type":"string","minLength":8,"maxLength":500}}}}}},"responses":{"200":{"description":"The payout (paid if last_check.status is verified)","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/Payout"},{"type":"object","properties":{"last_check":{"$ref":"#/components/schemas/Check"}}}]}}}},"400":{"description":"invalid_request, invalid_reference, test_reference, live_reference","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"invalid_key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"recipient_not_found, not_found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"no_accounts, not_pending, not_refundable, refund_too_large","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"rate_limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"internal_error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"bank_unavailable, unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/payout_batches":{"post":{"summary":"Create many payouts at once (all valid, or nothing is saved)","operationId":"createPayoutBatch","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["payouts"],"properties":{"name":{"type":"string","maxLength":120},"payouts":{"type":"array","minItems":1,"maxItems":500,"items":{"$ref":"#/components/schemas/CreatePayoutRequest"}}}}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PayoutBatch"}}}},"400":{"description":"invalid_request, invalid_reference, test_reference, live_reference","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"invalid_key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"internal_error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/payout_batches/{id}":{"get":{"summary":"Get a payout batch with its totals and payouts","operationId":"getPayoutBatch","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PayoutBatch"}}}},"401":{"description":"invalid_key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"recipient_not_found, not_found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/payouts/{id}/cancel":{"post":{"summary":"Cancel a payout that wasn't sent","operationId":"cancelPayout","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Payout"}}}},"401":{"description":"invalid_key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"recipient_not_found, not_found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"no_accounts, not_pending, not_refundable, refund_too_large","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}},"webhooks":{"payment.paid":{"post":{"summary":"A payment was paid on its checkout page.","parameters":[{"name":"Hisab-Pay-Signature","in":"header","required":true,"description":"t=<unix seconds>,v1=<hex HMAC-SHA256(secret, \"<t>.<raw body>\")>","schema":{"type":"string"}},{"name":"Hisab-Pay-Event","in":"header","required":true,"schema":{"type":"string","const":"payment.paid"}},{"name":"Hisab-Pay-Delivery","in":"header","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Event"}}}},"responses":{"200":{"description":"Any 2xx within 10 seconds; anything else is retried (1 min, 5 min, 30 min, 2 h, 6 h, 12 h)."}}}},"payment.expired":{"post":{"summary":"A pending payment passed `expires_at`.","parameters":[{"name":"Hisab-Pay-Signature","in":"header","required":true,"description":"t=<unix seconds>,v1=<hex HMAC-SHA256(secret, \"<t>.<raw body>\")>","schema":{"type":"string"}},{"name":"Hisab-Pay-Event","in":"header","required":true,"schema":{"type":"string","const":"payment.expired"}},{"name":"Hisab-Pay-Delivery","in":"header","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Event"}}}},"responses":{"200":{"description":"Any 2xx within 10 seconds; anything else is retried (1 min, 5 min, 30 min, 2 h, 6 h, 12 h)."}}}},"payment.canceled":{"post":{"summary":"A payment was canceled.","parameters":[{"name":"Hisab-Pay-Signature","in":"header","required":true,"description":"t=<unix seconds>,v1=<hex HMAC-SHA256(secret, \"<t>.<raw body>\")>","schema":{"type":"string"}},{"name":"Hisab-Pay-Event","in":"header","required":true,"schema":{"type":"string","const":"payment.canceled"}},{"name":"Hisab-Pay-Delivery","in":"header","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Event"}}}},"responses":{"200":{"description":"Any 2xx within 10 seconds; anything else is retried (1 min, 5 min, 30 min, 2 h, 6 h, 12 h)."}}}},"payment.created":{"post":{"summary":"A payment was created (API, dashboard or payment link).","parameters":[{"name":"Hisab-Pay-Signature","in":"header","required":true,"description":"t=<unix seconds>,v1=<hex HMAC-SHA256(secret, \"<t>.<raw body>\")>","schema":{"type":"string"}},{"name":"Hisab-Pay-Event","in":"header","required":true,"schema":{"type":"string","const":"payment.created"}},{"name":"Hisab-Pay-Delivery","in":"header","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Event"}}}},"responses":{"200":{"description":"Any 2xx within 10 seconds; anything else is retried (1 min, 5 min, 30 min, 2 h, 6 h, 12 h)."}}}},"payment.refunded":{"post":{"summary":"A refund of the payment was confirmed; `refunded` shows the total refunded so far.","parameters":[{"name":"Hisab-Pay-Signature","in":"header","required":true,"description":"t=<unix seconds>,v1=<hex HMAC-SHA256(secret, \"<t>.<raw body>\")>","schema":{"type":"string"}},{"name":"Hisab-Pay-Event","in":"header","required":true,"schema":{"type":"string","const":"payment.refunded"}},{"name":"Hisab-Pay-Delivery","in":"header","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Event"}}}},"responses":{"200":{"description":"Any 2xx within 10 seconds; anything else is retried (1 min, 5 min, 30 min, 2 h, 6 h, 12 h)."}}}},"check.completed":{"post":{"summary":"A `POST /v1/verify` check finished (any outcome).","parameters":[{"name":"Hisab-Pay-Signature","in":"header","required":true,"description":"t=<unix seconds>,v1=<hex HMAC-SHA256(secret, \"<t>.<raw body>\")>","schema":{"type":"string"}},{"name":"Hisab-Pay-Event","in":"header","required":true,"schema":{"type":"string","const":"check.completed"}},{"name":"Hisab-Pay-Delivery","in":"header","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Event"}}}},"responses":{"200":{"description":"Any 2xx within 10 seconds; anything else is retried (1 min, 5 min, 30 min, 2 h, 6 h, 12 h)."}}}},"check.flagged":{"post":{"summary":"A payment confirmed by SMS didn't match the official receipt when it was checked later (`flagged.reason`). Look into it before delivering more.","parameters":[{"name":"Hisab-Pay-Signature","in":"header","required":true,"description":"t=<unix seconds>,v1=<hex HMAC-SHA256(secret, \"<t>.<raw body>\")>","schema":{"type":"string"}},{"name":"Hisab-Pay-Event","in":"header","required":true,"schema":{"type":"string","const":"check.flagged"}},{"name":"Hisab-Pay-Delivery","in":"header","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Event"}}}},"responses":{"200":{"description":"Any 2xx within 10 seconds; anything else is retried (1 min, 5 min, 30 min, 2 h, 6 h, 12 h)."}}}},"risk.flagged":{"post":{"summary":"Fraud guard raised a flag: `data.object` is the flag (`kind`: reused_id, wrong_ids, large_amount, burst, blocked_payer, edited_proof; `check_id`, `payment_id`, `reference`, `amount`, `payer`, `held`, `detail`).","parameters":[{"name":"Hisab-Pay-Signature","in":"header","required":true,"description":"t=<unix seconds>,v1=<hex HMAC-SHA256(secret, \"<t>.<raw body>\")>","schema":{"type":"string"}},{"name":"Hisab-Pay-Event","in":"header","required":true,"schema":{"type":"string","const":"risk.flagged"}},{"name":"Hisab-Pay-Delivery","in":"header","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Event"}}}},"responses":{"200":{"description":"Any 2xx within 10 seconds; anything else is retried (1 min, 5 min, 30 min, 2 h, 6 h, 12 h)."}}}},"payout.created":{"post":{"summary":"A payout was created.","parameters":[{"name":"Hisab-Pay-Signature","in":"header","required":true,"description":"t=<unix seconds>,v1=<hex HMAC-SHA256(secret, \"<t>.<raw body>\")>","schema":{"type":"string"}},{"name":"Hisab-Pay-Event","in":"header","required":true,"schema":{"type":"string","const":"payout.created"}},{"name":"Hisab-Pay-Delivery","in":"header","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Event"}}}},"responses":{"200":{"description":"Any 2xx within 10 seconds; anything else is retried (1 min, 5 min, 30 min, 2 h, 6 h, 12 h)."}}}},"payout.paid":{"post":{"summary":"A payout was confirmed: the receipt shows the payee got the money.","parameters":[{"name":"Hisab-Pay-Signature","in":"header","required":true,"description":"t=<unix seconds>,v1=<hex HMAC-SHA256(secret, \"<t>.<raw body>\")>","schema":{"type":"string"}},{"name":"Hisab-Pay-Event","in":"header","required":true,"schema":{"type":"string","const":"payout.paid"}},{"name":"Hisab-Pay-Delivery","in":"header","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Event"}}}},"responses":{"200":{"description":"Any 2xx within 10 seconds; anything else is retried (1 min, 5 min, 30 min, 2 h, 6 h, 12 h)."}}}},"payout.canceled":{"post":{"summary":"A payout was canceled.","parameters":[{"name":"Hisab-Pay-Signature","in":"header","required":true,"description":"t=<unix seconds>,v1=<hex HMAC-SHA256(secret, \"<t>.<raw body>\")>","schema":{"type":"string"}},{"name":"Hisab-Pay-Event","in":"header","required":true,"schema":{"type":"string","const":"payout.canceled"}},{"name":"Hisab-Pay-Delivery","in":"header","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Event"}}}},"responses":{"200":{"description":"Any 2xx within 10 seconds; anything else is retried (1 min, 5 min, 30 min, 2 h, 6 h, 12 h)."}}}}},"components":{"securitySchemes":{"bearer":{"type":"http","scheme":"bearer","description":"hp_live_… or hp_test_… (also accepted as X-Api-Key)"}},"schemas":{"Error":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["invalid_request","invalid_reference","test_reference","live_reference","invalid_key","plan_limit","plan_expired","merchant_paused","payouts_paused","merchant_key","recipient_mismatch","platform_only","recipient_not_found","not_found","no_accounts","not_pending","not_refundable","refund_too_large","rate_limited","internal_error","bank_unavailable","unavailable"]},"message":{"type":"string"},"field":{"type":["string","null"]},"retry":{"type":"boolean"},"check_id":{"type":"string","format":"uuid"},"status":{"type":"string"},"errors":{"type":"array","description":"Payout batches: every bad line","items":{"type":"object","properties":{"index":{"type":"integer"},"field":{"type":["string","null"]},"message":{"type":"string"}}}}}}}},"VerifyRequest":{"type":"object","required":["reference"],"properties":{"reference":{"type":"string","minLength":8,"maxLength":500,"description":"Transaction ID (or a pasted SMS / receipt link)"},"method":{"type":"string","enum":["telebirr","cbe","cbe_birr"]},"amount":{"oneOf":[{"type":"number","minimum":0.01},{"type":"string","pattern":"^[\\d,]+(\\.\\d{1,2})?$"}],"description":"Birr: 1500, 19.99 or \"1,500.50\""},"order_id":{"type":"string","maxLength":100},"recipient":{"type":"string","pattern":"^[A-Za-z0-9._:-]{1,64}$"},"claim":{"type":"boolean","default":true}}},"Recipient":{"oneOf":[{"type":"object","properties":{"id":{"type":["string","null"]},"name":{"type":"string"}}},{"type":"null"}]},"Check":{"type":"object","required":["id","object","status","verified","livemode","method","reference"],"properties":{"id":{"type":"string","format":"uuid"},"object":{"const":"check"},"status":{"type":"string","enum":["verified","already_used","amount_mismatch","wrong_receiver","not_found","not_completed"]},"verified":{"type":"boolean"},"livemode":{"type":"boolean"},"method":{"type":"string","enum":["telebirr","cbe","cbe_birr"]},"reference":{"type":"string"},"amount":{"type":"string","pattern":"^-?\\d+\\.\\d{2}$","examples":["1500.00"]},"amount_santim":{"type":"integer"},"currency":{"const":"ETB"},"paid_on":{"type":["string","null"],"format":"date"},"payer":{"type":["string","null"]},"receiver":{"type":["string","null"]},"receiver_account":{"type":["string","null"]},"confirmed_by":{"type":"string","enum":["receipt","sms","test"],"description":"sms: confirmed by a forwarded bank SMS, re-checked against the receipt later (check.flagged if it disagrees)"},"risk":{"type":"object","description":"Fraud guard (live checks): present only when something looked wrong. hold = the payer is on your blocklist; don't deliver before you've looked.","properties":{"flagged":{"const":true},"reasons":{"type":"array","items":{"type":"string","enum":["reused_id","wrong_ids","large_amount","burst","blocked_payer"]}},"hold":{"type":"boolean"}}},"bank_status":{"type":"string"},"expected_amount":{"type":"string","pattern":"^-?\\d+\\.\\d{2}$","examples":["1500.00"]},"recipient":{"$ref":"#/components/schemas/Recipient"},"order_id":{"type":["string","null"]},"claimed":{"type":"boolean"},"claimed_at":{"type":"string","format":"date-time"},"used_by":{"type":"object","properties":{"order_id":{"type":["string","null"]},"at":{"type":["string","null"]}}}}},"CreatePaymentRequest":{"type":"object","required":["amount"],"properties":{"amount":{"oneOf":[{"type":"number","minimum":0.01},{"type":"string","pattern":"^[\\d,]+(\\.\\d{1,2})?$"}],"description":"Birr: 1500, 19.99 or \"1,500.50\""},"description":{"type":"string","maxLength":200},"order_id":{"type":"string","maxLength":100},"recipient":{"type":"string","pattern":"^[A-Za-z0-9._:-]{1,64}$"},"methods":{"type":"array","items":{"type":"string","enum":["telebirr","cbe","cbe_birr"]},"minItems":1,"maxItems":3,"uniqueItems":true},"customer":{"type":"object","properties":{"name":{"type":"string","maxLength":120},"phone":{"type":"string","maxLength":20},"email":{"type":"string","format":"email"}}},"metadata":{"type":"object","maxProperties":20,"additionalProperties":{"type":["string","number","boolean"]}},"success_url":{"type":"string","format":"uri","pattern":"^https://"},"cancel_url":{"type":"string","format":"uri","pattern":"^https://"},"expires_in":{"type":"integer","minimum":5,"maximum":43200,"description":"Minutes; default: the business's setting (1 day unless changed)"}}},"Payment":{"type":"object","required":["id","object","status","amount","checkout_url"],"properties":{"id":{"type":"string","format":"uuid"},"object":{"const":"payment"},"livemode":{"type":"boolean"},"status":{"type":"string","enum":["pending","paid","expired","canceled"]},"amount":{"type":"string","pattern":"^-?\\d+\\.\\d{2}$","examples":["1500.00"]},"amount_santim":{"type":"integer"},"currency":{"const":"ETB"},"description":{"type":["string","null"]},"order_id":{"type":["string","null"]},"recipient":{"$ref":"#/components/schemas/Recipient"},"methods":{"type":"array","items":{"type":"string","enum":["telebirr","cbe","cbe_birr"]}},"customer":{"oneOf":[{"type":"object","properties":{"name":{"type":["string","null"]},"phone":{"type":["string","null"]},"email":{"type":["string","null"]}}},{"type":"null"}]},"metadata":{"type":"object"},"checkout_url":{"type":"string","format":"uri"},"link_id":{"type":["string","null"],"format":"uuid"},"refunded":{"type":"string","pattern":"^-?\\d+\\.\\d{2}$","examples":["1500.00"]},"refunded_santim":{"type":"integer"},"exact_amount":{"type":["string","null"],"pattern":"^-?\\d+\\.\\d{2}$","examples":["1500.00"],"description":"No-typing checkout: the exact amount the checkout page asked for (the price + 0.01–0.99 ETB) because an SMS phone watches the account; the payment confirms itself when that amount arrives. Null if not used."},"exact_amount_santim":{"type":["integer","null"]},"success_url":{"type":["string","null"]},"cancel_url":{"type":["string","null"]},"expires_at":{"type":"string","format":"date-time"},"created_at":{"type":"string","format":"date-time"},"paid_at":{"type":["string","null"],"format":"date-time"},"canceled_at":{"type":["string","null"],"format":"date-time"},"paid_with":{"oneOf":[{"type":"object","properties":{"method":{"type":"string","enum":["telebirr","cbe","cbe_birr"]},"reference":{"type":"string"},"amount":{"type":"string","pattern":"^-?\\d+\\.\\d{2}$","examples":["1500.00"]},"amount_santim":{"type":"integer"},"payer":{"type":["string","null"]},"check_id":{"type":"string","format":"uuid"}}},{"type":"null"}]}}},"CreatePayoutRequest":{"type":"object","required":["amount","method"],"description":"Give account and name, or a recipient.","properties":{"amount":{"oneOf":[{"type":"number","minimum":0.01},{"type":"string","pattern":"^[\\d,]+(\\.\\d{1,2})?$"}],"description":"Birr: 1500, 19.99 or \"1,500.50\""},"method":{"type":"string","enum":["telebirr","cbe","cbe_birr"]},"account":{"type":"string","description":"Phone 09…/07… (Telebirr, CBE Birr) or 13-digit CBE account"},"name":{"type":"string","maxLength":120},"recipient":{"type":"string","pattern":"^[A-Za-z0-9._:-]{1,64}$"},"description":{"type":"string","maxLength":200},"external_id":{"type":"string","pattern":"^[A-Za-z0-9._:-]{1,100}$"},"metadata":{"type":"object","maxProperties":20,"additionalProperties":{"type":["string","number","boolean"]}}}},"Payout":{"type":"object","required":["id","object","status","amount","method","account","name"],"properties":{"id":{"type":"string","format":"uuid"},"object":{"const":"payout"},"kind":{"type":"string","enum":["payout","refund"]},"payment_id":{"type":["string","null"],"format":"uuid","description":"Refunds: the payment refunded"},"livemode":{"type":"boolean"},"status":{"type":"string","enum":["pending","paid","canceled"]},"amount":{"type":"string","pattern":"^-?\\d+\\.\\d{2}$","examples":["1500.00"]},"amount_santim":{"type":"integer"},"currency":{"const":"ETB"},"method":{"type":"string","enum":["telebirr","cbe","cbe_birr"]},"account":{"type":"string"},"name":{"type":"string"},"recipient":{"$ref":"#/components/schemas/Recipient"},"description":{"type":["string","null"]},"external_id":{"type":["string","null"]},"metadata":{"type":"object"},"created_at":{"type":"string","format":"date-time"},"paid_at":{"type":["string","null"],"format":"date-time"},"canceled_at":{"type":["string","null"],"format":"date-time"},"paid_with":{"oneOf":[{"type":"object","properties":{"reference":{"type":"string"},"amount":{"type":"string","pattern":"^-?\\d+\\.\\d{2}$","examples":["1500.00"]},"amount_santim":{"type":"integer"},"sender":{"type":["string","null"]},"check_id":{"type":"string","format":"uuid"}}},{"type":"null"}]},"merchant_fee":{"type":["string","null"],"pattern":"^-?\\d+\\.\\d{2}$","examples":["1500.00"],"description":"What you charge the merchant for this payout (Merchants → payout fee). Set when a live payout to a merchant is paid; null otherwise and for refunds."},"merchant_fee_santim":{"type":["integer","null"]}}},"PayoutBatch":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"object":{"const":"payout_batch"},"livemode":{"type":"boolean"},"name":{"type":"string"},"created_at":{"type":"string","format":"date-time"},"totals":{"type":"object","properties":{"count":{"type":"integer"},"amount":{"type":"string","pattern":"^-?\\d+\\.\\d{2}$","examples":["1500.00"]},"paid_count":{"type":"integer"},"paid_amount":{"type":"string","pattern":"^-?\\d+\\.\\d{2}$","examples":["1500.00"]},"pending_count":{"type":"integer"},"pending_amount":{"type":"string","pattern":"^-?\\d+\\.\\d{2}$","examples":["1500.00"]},"canceled_count":{"type":"integer"}}},"payouts":{"type":"array","items":{"$ref":"#/components/schemas/Payout"}}}},"Event":{"type":"object","required":["id","object","type","livemode","created_at","data"],"properties":{"id":{"type":"string","format":"uuid","description":"Use it to ignore repeated deliveries"},"object":{"const":"event"},"type":{"type":"string","enum":["payment.paid","payment.expired","payment.canceled","payment.created","payment.refunded","check.completed","check.flagged","risk.flagged","payout.created","payout.paid","payout.canceled","ping"]},"livemode":{"type":"boolean"},"created_at":{"type":"string","format":"date-time"},"data":{"type":"object","properties":{"object":{"oneOf":[{"$ref":"#/components/schemas/Payment"},{"$ref":"#/components/schemas/Payout"},{"$ref":"#/components/schemas/Check"},{"type":"object"}]}}}}}}}}