Create a payment
Creates a payment intent and returns the link to give the payer (checkout_url). The
Idempotency-Key header is required: replaying the same request returns the same payment.
Payment through the page (without network): the optional country and networks restrict the networks
offered to the payer; both combine (intersection). A network that is unavailable right now is left out; if none
remains, the response is 422 no_network_available and nothing is created. networks in the response gives
the final list.
Direct payment: as soon as network is present (with msisdn), the payment is direct: the attempt opens
in the same call, the response carries next_action, networks only holds that network and checkout_url is
null. country and networks are then ignored. What the payment method requires is checked before anything
is created: a code network without otp answers 422 otp_required, a redirect network without return_url
answers 422 return_url_required, and nothing is created. Other attempt refusals (invalid_msisdn,
network_not_allowed…) leave the payment pending; replay with the same Idempotency-Key once fixed.
ApiKeyBearerAuthorizationBearer <sk_test_… | sk_live_…>The application's API key. sk_test_…: sandbox, no money moves. sk_live_…: real.
Idempotency-Key*stringIdentifies the request: replaying it (unstable network) does not create a second payment. 1 to 255 characters, a unique identifier per creation (UUID recommended).
1 <= length <= 255application/json- body
merchant_reference*stringYour order reference. Unique per application.
1 <= length <= 128amount*|Amount in major units, strictly positive: a number (15.5) or a string ("15.50"). No
scientific notation. No more decimals than the currency allows (XOF: none).
currency*string^[A-Z]{3}$description?stringlength <= 500return_url?stringThe payer's return link. http(s) only: a javascript: link would run on the page.
^https?://\S+$length <= 2048country?stringPayment through the page only: offers only this country's networks (two-letter ISO code). Ignored for a direct payment.
^[A-Z]{2}$networks?array<string>Payment through the page only: offers only these networks. Empty or absent: no restriction. Combines
with country. Ignored for a direct payment.
network?stringMakes the payment direct, without a payment page: with msisdn, the attempt opens in the same call.
The response then carries next_action (NONE or REDIRECT) and redirect_url.
msisdn?stringThe payer's number. Requires network.
length <= 32otp?stringThe operator's code, required by a USSD_PULL network (422 otp_required otherwise, with no call to the
aggregator). Never stored, logged, or part of the idempotency fingerprint.
metadata?Free-form JSON object, returned as is in webhooks.
Payment created, or replayed if the idempotency key was already used for the same request.
application/json- response
id*stringuuidstate*PaymentState"CREATED""AWAITING_CUSTOMER""PROCESSING""SUCCEEDED""FAILED""EXPIRED""CANCELED"mode*string"LIVE""TEST"merchant_reference*stringamount*stringAmount in major units, at the currency's exponent.
amount_minor*integerThe same amount in minor units.
int64currency*stringdescription?string|nullmetadata*networks*array<string>Networks the payer can choose, in alphabetical order: those left after country and networks.
Only one for a direct payment, the one the merchant chose.
network?|The network of the latest attempt, the one the payer paid or tried to pay with; null until they have tried.
checkout_url*|The payment page link, to give the payer. null for a direct payment, which skips the page: for a
redirect network (Wave), the operator's link is redirect_url.
expires_at*stringdate-timesucceeded_at?|date-timecreated_at*stringdate-timeattempts?array<>|Present when reading a payment and in the response of a direct payment (the opened attempt);
null when creating a payment with a payment page, in the list and on cancellation.
next_action?stringOnly present in a direct payment's response (network and msisdn at creation).
REDIRECT: send the payer to redirect_url. NONE: nothing to do, the payer confirms on their
phone; follow the payment with GET /v1/payments/{id} or the webhook.
"NONE""REDIRECT"redirect_url?|Only present in the response of a direct payment. The operator's page, for REDIRECT.
curl -X POST 'https://api.flowpay.example/api/v1/payments' \ -H 'Idempotency-Key: cle-2026-0001' \ -H 'Content-Type: application/json' \ -d '{ "merchant_reference": "CMD-2026-0001", "amount": 5000, "currency": "XOF"}'{ "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", "state": "CREATED", "mode": "LIVE", "merchant_reference": "string", "amount": "5000", "amount_minor": 5000, "currency": "XOF", "description": "string", "metadata": {}, "networks": [ "BF_ORANGE" ], "network": "BF_ORANGE", "checkout_url": "string", "expires_at": "2019-08-24T14:15:22Z", "succeeded_at": "2019-08-24T14:15:22Z", "created_at": "2019-08-24T14:15:22Z", "attempts": [ { "attempt_no": 1, "state": "CREATED", "provider_key": "LIGDICASH", "route_reason": "LOWEST_COST", "route_cost_minor": 0, "failure_class": "CUSTOMER_DECLINED", "created_at": "2019-08-24T14:15:22Z", "settled_at": "2019-08-24T14:15:22Z" } ], "next_action": "NONE", "redirect_url": "string"}