POST/v1/payment/tokenAPI Key required
Create a short-lived payment token representing a fixed amount. Share the token link with a customer to collect payment.
When to use this
Payment tokens exist for the case where you don’t have the customer’s phone number yet, or don’t want to build a checkout UI at all. Generate a token for a fixed amount, then send the pay_url anywhere text or links work: SMS, email, WhatsApp, an invoice PDF. The customer opens it, enters their own phone number, and pays. See the Payment Tokens guide for the full flow and how it compares to calling Collect Payment directly.
- Invoicing a customer by email or WhatsApp with a one-tap payment link
- Point-of-sale QR codes for a fixed-price item
- Deposit or booking-fee links sent before a service is confirmed
Request headers
| Field | Type | Required | Description |
|---|---|---|---|
| Authorization | string | Required | Bearer your_api_key |
| Content-Type | string | Required | application/json |
Request body
| Field | Type | Required | Description |
|---|---|---|---|
| amount | number | Required | Amount to charge when the token is paid |
| currency | string | Required | One of UGX, KES, GHS, XAF |
| merchant_reference | string | Optional | Your own reference ID |
| expires_in | number | Optional | Seconds until the token expires. Default 3600 |
Request example
curl -X POST https://api.kawrie.com/v1/payment/token \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"amount": 15000,
"currency": "UGX",
"merchant_reference": "INVOICE-77"
}'Response200 OK
{
"success": true,
"data": {
"token": "pt_9f2h1k3a8b7c",
"pay_url": "https://pay.kawrie.com/pt_9f2h1k3a8b7c",
"amount": 15000,
"currency": "UGX",
"expires_at": "2026-06-28T11:30:00.000Z"
}
}Error responses
| Code | Status | Description |
|---|---|---|
| INVALID_AMOUNT | 400 | Amount must be greater than zero |
| INVALID_API_KEY | 401 | API key is invalid or missing |
| RATE_LIMIT_EXCEEDED | 429 | Too many requests |