POST /api/v1/payments with type: "dynamic-qr".
Idempotency-Key required — requests without it are rejected with 400 IDEMPOTENCY_KEY_REQUIRED. Idempotency.
Returns 201 with status: "pending", a qr_code payload, and a payment_url fallback, or 200 when replaying an existing Idempotency-Key.
Body
| Field | Required | Notes |
|---|---|---|
amount, currency, type, customer, phone | yes | type must be "dynamic-qr". Currencies: TZS, USD, KES, UGX |
customer | yes | firstname, lastname, email only — billing address is not required |
redirect_url, cancel_url | no | Optional; forwarded to the hosted checkout page when set |
network | no | Validated against the supported operator list when provided; not needed for QR |
reference, metadata | no | Duplicate live reference → 409 DUPLICATE_REFERENCE |
webhook_url | no | Recommended — status events; overrides merchant default |
callback_url | no | Optional — one-shot terminal notification; omit unless you need a separate callback endpoint |
What the customer sees
- You receive
qr_codeandpayment_urlin the response (the payment link is also sent to the customer’s email and phone). - Render the QR code in your UI (checkout, POS display, in-app screen).
- The customer scans with their mobile-money or bank app and confirms.
- If scanning is not possible, redirect them to
payment_urlinstead. - PayGrid sends a webhook when the payment reaches a terminal status.
qr_code falls back to payment_url.
Unfinished payments expire roughly 30 minutes after creation.
Error semantics
| HTTP | error_code | Meaning |
|---|---|---|
| 400 | IDEMPOTENCY_KEY_REQUIRED | Missing Idempotency-Key header |
| 400 | VALIDATION_ERROR | Missing required fields, invalid network, or unsupported currency |
| 402 | PAYMENT_DECLINED | Payment declined immediately — no charge; details has transaction_id, status: "failed", and reference |
| 409 | DUPLICATE_REFERENCE | A live (pending/processing/completed) payment with this reference exists; failed, cancelled, or expired attempts do not block a retry |
| 502 | PROVIDER_UNAVAILABLE / PROVIDER_ERROR | Temporary upstream outage — retry with the same Idempotency-Key |
API reference
Create Dynamic QR Payment

