# QuataPay endpoints used by an integration Base URL: `https://api.quatapay.com/api/v1` (test and live). Auth: `Authorization: Bearer `, key from `QUATAPAY_API_KEY`. | Method | Path (after the base URL) | |---|---| | POST | `/gateway/payments` | | POST | `/gateway/sandbox/payments` | | GET | `/gateway/payments/{payment_id}` | | GET | `/gateway/sandbox/payments/{payment_id}` | | GET | `/gateway/payments` | | GET | `/gateway/sandbox/payments` | | POST | `/gateway/sandbox/payments/{slug}/simulate` | | POST | `/gateway/sandbox/payments/{slug}/cancel` | | GET | `/gateway/checkout/{slug}` | | POST | `/gateway/checkout/{slug}/cancel` | | POST | `/payment-links/{slug}/checkout` | Test keys (`qpay_test_...`) use the `/gateway/sandbox/...` paths; live keys (`qpay_live_...`) use `/gateway/...`. The wrong pairing is HTTP 403. Only `/gateway/checkout/{slug}`, `/gateway/checkout/{slug}/cancel` and `/payment-links/{slug}/checkout` need no key. ## Create a payment Fields: `amount`, `currency`, `description`, `return_url`, `cancel_url`, `failure_url`, `customer_reference`, `order_reference`, `metadata`, `expires_in_minutes`, `webhook_url`, `allowed_methods`. Required: `amount` (integer XAF, 1 to 100,000,000,000) and `currency` (`XAF`). Unknown fields are HTTP 422. - `return_url`, `cancel_url`, `failure_url`: https (http only for localhost), no credentials. QuataPay adds no query parameters when it redirects. - `customer_reference` max 120 characters; `order_reference` 1 to 64 characters (letters, digits, space, `_ # . / -`); `description` max 2000. - `expires_in_minutes` 1 to 1440 (default 60). `allowed_methods`: `["wallet"]`, `["momo"]` or both. - `metadata.line_items`: up to 20 `{ "label", "amount" }` rows that add up to `amount`. - Header `Idempotency-Key` (max 255 characters). A replay returns the first response with `Idempotency-Replayed: true`; the same key with a different body is 409. Response 201: `data.payment` (`id`, `slug`, `status`, `amount`, `currency`, `mode`, `expires_at`, ...) and `data.checkout_url`. ## Read a payment `GET /gateway/payments/{payment_id}` (sandbox: `/gateway/sandbox/payments/{payment_id}`), by `id`. `data` has `status` (`requested`, `processing`, `succeeded`, `failed`, `cancelled`, `expired`), `completed_at`, `completed_transaction_id`, `failure_reason`, `payment_method` (`wallet`, `momo` or null), `allowed_methods`, `expires_at` and your metadata as `metadata_json`. List: `GET /gateway/payments?status=succeeded&limit=50` (limit 1 to 200). ## Checkout preview and the Mobile Money fee `GET /gateway/checkout/{slug}` (no key) returns `data.methods[]`; each method can carry `fee_note`: `{ "kind": "zero" | "processing" | "government" | "fee", "bps": number, "flat": number, "amount": number | null }`. For Mobile Money, `kind` is `processing` and `bps` is the payer fee in basis points (130 = 1.3% today; an admin setting, so read it, do not hard-code it). It also has `data.momo_payer_fee`, `data.momo_payer_fee_bps` and `data.momo_total`. The fee is added on top of `amount` for the customer and is shown before they confirm. ## Sandbox `POST /gateway/sandbox/payments/{slug}/simulate` with `{ "outcome": "succeeded" }` or `{ "outcome": "failed", "failure_reason": "..." }`; `POST /gateway/sandbox/payments/{slug}/cancel`. A test-mode checkout cannot be paid in a browser. ## Errors Envelope `{ "success": false, "data": null, "error": "", "code": "", "details": {...} }`. `code` is `VALIDATION_ERROR` for 422 and `HTTP_` otherwise. 401 bad key, 403 wrong key mode or suspended merchant, 404 not found, 409 idempotency or state conflict, 422 validation, 423 currency not enabled, 429 rate limit (60 requests per 60 seconds per API key and endpoint, with `Retry-After`), 503 API paused. Every response has `X-Request-ID`.