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

FieldTypeRequiredDescription
AuthorizationstringRequiredBearer your_api_key
Content-TypestringRequiredapplication/json

Request body

FieldTypeRequiredDescription
amountnumberRequiredAmount to charge when the token is paid
currencystringRequiredOne of UGX, KES, GHS, XAF
merchant_referencestringOptionalYour own reference ID
expires_innumberOptionalSeconds 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

response.json
{
  "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

CodeStatusDescription
INVALID_AMOUNT400Amount must be greater than zero
INVALID_API_KEY401API key is invalid or missing
RATE_LIMIT_EXCEEDED429Too many requests