Payment links
Ask anyone to pay you with a link they can pay by M-Pesa or card, no account needed.
A payment link asks someone for a fixed amount. They open it, pay by M-Pesa (or card, where it's on), and the money lands in your AutoPayKe balance. The payer doesn't need an account.
The JavaScript and Python samples use the call helper from Errors.
Create a link
curl -X POST "https://api.autopayke.com/api/v1/payment-requests" \
-H "Authorization: Bearer $AUTOPAYKE_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"amount": "2500",
"description": "Invoice 1042, fertiliser",
"allowedMethods": ["mobile_money"],
"expiresInDays": 7
}'Send the url by SMS, WhatsApp, email or a QR code. It works on any phone with a browser.
Build your own pay page
If you'd rather keep payers on your own site, the payer endpoints are public. Load the link, then pay it:
curl "https://api.autopayke.com/api/v1/p/Kq7mZp2xA"
curl -X POST "https://api.autopayke.com/api/v1/p/Kq7mZp2xA/pay" \
-H "Content-Type: application/json" \
-d '{ "method": "mobile_money", "country": "KE", "phone": "+254712345678", "idempotencyKey": "inv-1042-1" }'Then poll GET /api/v1/p/{code}/payments/{id} until the status is final.
Lifecycle
| Link status | Means |
|---|---|
active | Can be paid |
paid | Paid; paidAt says when |
expired | Passed expiresAt unpaid |
cancelled | You cancelled it |
Who pays the card fee
With cardFeePayer: "customer" (the default) a card payer pays the card fee on top. With "owner", it's taken from what you receive. Mobile money payers pay the amount on the link.