Skip to content

Payment links (payer)

The public side of a payment link: what the payer sees, paying it, and following the payment. No account is needed to pay.

No key needed: call these from a terminal, a server or a coding agent.

GET/api/v1/p/{code}
Public

What the payer needs to see: who is asking, how much, for what, and which methods are live for this link right now.

Path parameters
  • codestringrequired

    The link code: 6–32 letters, digits, - or _.

Request
curl "https://api.autopayke.com/api/v1/p/Kq7mZp2xA"
Response200 application/json
{
  "ok": true,
  "data": {
    "code": "Kq7mZp2xA",
    "requesterName": "Wanjiku Farm Supplies",
    "verified": true,
    "amount": "250000",
    "currency": "KES",
    "description": "Invoice 1042: fertiliser",
    "status": "active",
    "expiresAt": "2026-11-10T09:00:00.000Z",
    "methods": [
      "mobile_money"
    ],
    "cardFeePayer": "customer"
  }
}
POST/api/v1/p/{code}/pay
Public 10 requests per 5 minutes per IP address.

Starts the payment. For mobile money the payer gets a prompt on their phone; for card the response carries a hosted checkout URL. Card details are never accepted by this API.

Path parameters
  • codestringrequired

    The link code.

Body (JSON)
  • methodstringrequired

    How the payer pays. Must be one of the link's live methods.

    cardmobile_moneybank
  • countrystringrequired

    ISO 3166-1 alpha-2 code of the payer.

  • phonestringoptional

    International format, required for mobile_money.

  • operatorstringoptional

    Mobile money operator code from /capabilities, e.g. Safaricom.

  • firstNamestringoptional

    Up to 60 characters. Prefills the card checkout.

  • lastNamestringoptional

    Up to 60 characters.

  • emailstringoptional

    Payer's email, for the receipt.

  • idempotencyKeystringoptional

    8–80 characters. Retrying with the same key returns the same payment instead of charging twice.

Request
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",
    "operator": "Safaricom",
    "idempotencyKey": "order-1042-attempt-1"
  }'
Response201 application/json
{
  "ok": true,
  "data": {
    "id": "7b1f0c7e-1f3c-4a43-9a8f-3f0d6a2b9c11",
    "status": "processing",
    "checkoutUrl": null,
    "virtualAccount": null,
    "stepRequired": "Approve the M-Pesa prompt on your phone",
    "chargeAmount": "250000",
    "chargeCurrency": "KES",
    "feeAmount": "0",
    "expiresAt": "2026-11-03T09:15:00.000Z"
  }
}

Get a payment's status

GET/api/v1/p/{code}/payments/{id}
Public

Poll this after paying until status is final (credited, failed, expired, cancelled or reversed).

Path parameters
  • codestringrequired

    The link code.

  • idstringrequired

    The id returned when paying.

Request
curl "https://api.autopayke.com/api/v1/p/Kq7mZp2xA/payments/7b1f0c7e-1f3c-4a43-9a8f-3f0d6a2b9c11"
Response200 application/json
{
  "ok": true,
  "data": {
    "id": "7b1f0c7e-1f3c-4a43-9a8f-3f0d6a2b9c11",
    "status": "credited",
    "failureReason": null
  }
}