How do I accept Wave and Orange Money in a Flutter app?
A Flutter app goes through a server that creates the payment with the API key, then opens checkout_url. The key never goes into the app.
A Flutter app does not call 221 Pay with the API key: it asks its own server to
create the payment, then opens the checkout_url address it receives. The
server then confirms the result by webhook.
The Dart SDK sdk221 is published on pub.dev (221 SDKs);
the API can also be called directly, from any server language.
Why a server
A key placed in a published app can be extracted by any user: it gives access to the project's payments, refunds and payouts. The Authentication documentation forbids it: the key stays server side.
Flow
The server exposes an order route
For example POST /orders/{id}/pay, protected by the user's sign-in. It reads
the amount on the server, never from the app.
The server creates the payment
POST /v1/payments with rail set to sn_wave or sn_orange, the order number
in merchant_reference and a stable Idempotency-Key per order. Examples in
five languages: How do I accept a first payment through the API?
The app opens checkout_url
The server returns checkout_url to the app, which opens it in the device
browser (maintained url_launcher package) or in a web view. The customer pays
with Wave or Orange Money, then returns to return_url, an https:// address
(http:// is refused).
The webhook is authoritative
On payment.succeeded, the server verifies the signature, reads the payment
again and marks the order paid. The app asks its server, not 221 Pay, to show
"paid". See Webhooks.
Test
A sk_221_pay_test_ key confirms payments within seconds, without real money
(Testing).
Variant without a server
To collect without a server, a payment link is enough: the app opens
link_to_pay. The amount is fixed and order matching is manual. See
Payment links.
Last updated on
How do I collect Wave and Orange Money on an online store?
Hosted store such as Shopify or a custom site: payment links without code, or the API from a server. No 221 Pay Shopify app is published.
How does a freelancer without a company collect with Wave or Orange Money?
A freelancer collects clients through Wave and Orange Money with one payment link per invoice, without NINEA or RCCM. ID document before the first payout.