Merchants
Hosted checkout
Send the customer to KulPay's payment page; they choose how to pay and come back to your site.
Instead of building the payment screens yourself, create a charge without choosing the method and send the customer to its checkout_url. KulPay's page shows the methods open to you (M-Pesa, e-Mola, card, bank transfer and, where it is enabled, "Pagar com KulPay" from the customer's KulPay balance), takes the payment and sends the customer back to your return_url.
Before you start
Your application and its key with payments:write and payments:read, a webhook endpoint for payment.*, and a page on your site to return to.
The flow at a glance
| # | Who | What happens |
|---|---|---|
| 1 | Your system | Creates the charge with your return_url. |
| 2 | Customer | Is redirected to the checkout_url and pays there with the method they choose. |
| 3 | KulPay | Sends the result to your webhook and the customer back to your return_url. |
| 4 | Your system | Reads the payment before showing "paid". |
1. Create the charge
Your system.
POST /charges · API reference
Leave the method to the customer, or narrow it with allowed_sources / blocked_sources. The answer's checkout_url is the page to send the customer to. With open_amount: true the customer types the amount (between min_amount and max_amount, with optional suggested_amounts), useful for donations and tips.
Request
{
"payment_id": "ord-2026-10-22-000982",
"money": {
"amount": "1500.00",
"currency": "MZN"
},
"source": {
"type": "card"
},
"customer": {
"email": "ana@example.co.mz"
},
"country": "MZ",
"description": "Order 982",
"return_url": "https://shop.example.co.mz/orders/982/return"
}
2. The customer pays on KulPay's page
Customer.
The page shows your business, the amount and the methods. A card is typed into the acquirer's own fields, never into your site or KulPay's. A bank transfer can be paid and its proof uploaded on the page (manual payments): the payment waits until the transfer is confirmed.
3. Back on your site
Your system, at your `return_url`.
GET /payments/{provider_payment_id} · API reference
The return alone is not proof of payment: the customer may have closed the page or the payment may still be confirming. Read the payment (or wait for the webhook) and show the result it says.
States
| State | What it means |
|---|---|
requires_action | The customer is on the page, or completing a step there. |
pending | Paid on the page, confirming with the provider. |
succeeded | Paid. |
failed | Not paid. Offer to try again. |
When the money moves
As for any payment: succeeded means paid; where the money lands depends on your arrangement (Getting paid).
Events
| Event | What it tells you |
|---|---|
payment.method_selected | The customer chose a method on the page. |
payment.succeeded | Paid. |
payment.failed | Not paid. |
Errors that matter here
Every error is application/problem+json with a stable code; branch on the code, not the message. The full list is in the error catalogue.
| Error | When | What to do |
|---|---|---|
400 raw_card_data_not_accepted | A card number was sent to the API. | Never send card numbers; use the hosted page (or the acquirer's token). |
409 idempotency_key_reused | The | A new payment, a new ID. |
Testing it
Create a test charge and open its checkout_url: in test mode the page offers buttons to confirm, decline or cancel the payment, so you can test your return page for each.