Skip to Content
FlowPayDocs

Direct payment

Charge a phone number from your own interface, without the FlowPay payment page.

By default, creating a payment returns a checkout_url: you send the customer to the FlowPay payment page, which collects their network and number. If your own interface already collects them, open the attempt in the create call: that is a direct payment.

When to use it

You want to…Use
Send the customer to a ready-made payment pageA payment with checkout_url (Payments)
Keep the flow inside your app or siteA direct payment

A direct payment is made from your server, with your secret key: your interface sends the network and the number to your server, which calls FlowPay. Never put the API key in a mobile app or a web page.

The call

It is the usual POST /v1/payments, with three more fields. As soon as network is present, the payment is direct.

FieldDescription
networkThe network the customer picked, for example BF_ORANGE.
msisdnThe customer's number, with or without country code. Requires network.
otpThe operator's code, for "code" networks only (see below). 4 to 8 digits.
curl -X POST "$FLOWPAY_URL/v1/payments" \
  -H "Authorization: Bearer sk_test_..." \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
    "merchant_reference": "CMD-2026-0004",
    "amount": 5000,
    "currency": "XOF",
    "network": "BF_ORANGE",
    "msisdn": "+22670000001",
    "otp": "123456"
  }'

country and networks, which restrict the payment page's networks, are useless here: the network is already chosen, so they are ignored.

The open networks, with their key, are listed by GET /v1/referential/networks, without authentication. A network whose is_active is false appears in the list but cannot receive a payment.

The response

The response is the usual payment (see Payments): networks only holds the chosen network and checkout_url is null, since the customer skips the payment page. It also carries:

FieldDescription
next_actionWhat is left to do: NONE or REDIRECT.
redirect_urlWhere to send the customer for REDIRECT, otherwise null.
attemptsOne entry: the attempt that just opened.
{
  "id": "6f1c2d3e-0000-4000-8000-000000000001",
  "state": "PROCESSING",
  "merchant_reference": "CMD-2026-0004",
  "amount": "5000",
  "currency": "XOF",
  "next_action": "NONE",
  "redirect_url": null,
  "attempts": [{ "attempt_no": 1, "provider_key": "LIGDICASH" }]
}

Shortened example: the full response carries every payment field.

next_actionWhat you do
NONENothing. The customer approves on their phone (or the code was already supplied). Wait for the outcome.
REDIRECTSend the customer to redirect_url. They pay at their operator, then come back to your return_url, required for these networks.

Follow the outcome

Opening the attempt is not the outcome: the payment is only settled once it reaches SUCCEEDED.

  • Webhook (recommended): you receive payment.succeeded or payment.failed. See Webhooks.
  • Read: GET /v1/payments/{id}. Poll a few seconds apart: the limit is 60 requests per minute (see Authentication).

Code networks

On some networks, the customer first generates a code with their operator (for example by dialing a USSD code), and you pass it in otp.

  • Without otp, the request is refused with 422 otp_required, with no call to the operator.
  • The code is never stored, logged, returned, or counted for idempotency. Do not log it on your side either.
  • It is only used for the first attempt.

When the attempt is refused

What the network requires is checked before anything is created: without otp on a code network (422 otp_required) or without return_url on a redirect network (422 return_url_required), nothing is created. Fix it and send the request again.

For other refusals, the payment is created before the attempt: it already exists and stays waiting for the customer. Fix the cause and replay with the same Idempotency-Key: you get the same payment, and the attempt is reopened.

StatuserrorCause
422invalid_msisdnNumber invalid for this network.
422msisdn_not_allowedThis payment cannot be settled from this number.
422network_not_allowedNetwork not offered for this payment.
422otp_requiredThe network requires a code. Nothing is created.
422return_url_requiredThe network redirects the customer: return_url is required. Nothing is created.
422invalid_otpInvalid code: 4 to 8 digits.
422no_route_availableNo provider available for this network.

The full list is in Errors. A payment gets at most three attempts, automatic failover to another provider included.

Test it

With an sk_test_… key no money moves: a number ending in 0000 is refused by the sandbox, any other is accepted and then settled after a few seconds. See Quickstart.

On this page