What happens
- Create a quote with
paymentMethod: "MOBILEMONEY"andpaymentSource.phoneNumber. - The API returns the quote immediately.
- Within a few seconds, an STK prompt is sent to that phone.
- The customer enters their M-Pesa or Airtel Money PIN.
- The prompt expires in 20 seconds. If they miss it, create a new quote.
- After they authorize, do nothing else. Mavapay processes the payment and sends a webhook.
Where the funds go
paymentCurrency is what amount means. It must be sourceCurrency or targetCurrency.
USDTCENT— USDT cents (1000= 10 USDT)BTCSAT— satoshisKESCENT— Kenyan shilling cents (100= 1 KES)
targetCurrency and, when the amount is in BTC, paymentCurrency.
Buy USDT into the internal wallet
Tell the customer to approve the prompt. If it expires, create the quote again.
Buy BTC into the internal wallet
Same request. Set the target to Bitcoin. HerepaymentCurrency is BTCSAT, so amount is satoshis.
paymentCurrency to KESCENT and pass amount in cents.
Buy BTC to an external address
Setautopayout to true and targetCurrency to BTCSAT. The customer must provide one of lnInvoice, lnAddress, or onChainAddress.
Lightning invoice
Send USDT to an external address
Setautopayout to true and pass a USDT beneficiary. See beneficiary formats.
Instant cross-border payouts
The same KES payment can settle straight to another currency. Passautopayout: true and the beneficiary for that currency. Settlement starts once the customer authorizes the STK prompt.
NGN bank account
100 = 1 ZAR).
Webhooks
After the customer authorizes, Mavapay sends the usual payment webhooks. You do not confirm the STK prompt yourself.
See webhook examples.
