OTP gateways (Edfali, Sadad, Yasr Pay…)
Two steps: verify sends the OTP to the customer and returns a process_id; confirm completes the payment.
1) verify
POST /api/v1/transaction/{gateway}/verify
| Field | Required | Notes |
|---|---|---|
amount |
yes | XXX, XX.X, XX.XX |
mobile_number |
per gateway | 09XXXXXXXX |
birth_year |
Sadad / Sahary | 4 digits |
identity_card |
Yasr Pay | 9 digits (10 for Development Bank) |
Response: { "status": 200, "result": { "process_id": "PRC_..." }, "message": "OTP has been sent to your mobile number" } — valid for 10 minutes.
2) confirm
POST /api/v1/transaction/{gateway}/confirm
| Field | Required | Notes |
|---|---|---|
process_id |
yes | from verify |
code |
yes | the OTP |
amount |
yes | same as verify |
invoice_no |
yes | unique, ≤100 chars |
customer_ip |
no |
Response: { "status": 200, "result": { "transaction_id", "amount", "fee", "net_amount", "invoice_no" }, "message": "Transaction completed successfully" }
3) status
GET /api/v1/transaction/{transaction_id or invoice_no} → status (pending|success|failed) and approved (1/0).