Hosted checkout

Create a checkout and send your customer to the checkoutUrl JKAPay returns. The customer pays on a secure hosted page with a debit/credit card or mobile money, then JKAPay sends them back to your returnUrl and POSTs the final result to your webhook. You never handle card details.

How it works

  1. Your server calls POST /v1/checkout/initialize with the amount and a returnUrl.
  2. Redirect the customer's browser to the checkoutUrl in the response.
  3. The customer pays by card or mobile money.
  4. JKAPay confirms the payment and redirects the customer to your returnUrl with reference, clientReference and status query parameters.
  5. JKAPay POSTs the final transaction to your webhook. Fulfil the order from the webhook (or from Retrieve a checkout), never from the redirect alone.
POST/v1/checkout/initialize

Request body

Parameters
amount
string | integerrequired
The amount to charge. A GHS string like "150.00" or an integer in pesewas (15000). Minimum GHS 1.00.
currency
string
Defaults to GHS. Currently the only supported value.
returnUrl
stringrequired
Where JKAPay sends the customer after they pay or cancel. Must be a public https URL. We append reference, clientReference and status (SUCCESS, FAILED or CANCELLED).
customer.email
string
Strongly recommended. The customer's payment receipt is sent here. Maximum 160 characters.
customer.name
string
The customer's name, for your records. Maximum 120 characters.
customer.msisdn
string
The customer's phone number, if you have it. Optional for checkout.
channels
string[]
Payment methods to offer: any of card and mobile_money. Omit to offer every method available on your account.
description
string
What the customer is paying for. Shown on the checkout page. Maximum 255 characters.
callbackUrl
string
Webhook URL for this checkout only. Falls back to the webhook URL on your Settings page. See Webhooks.
merchantRef
string
Your own reference (order ID, invoice number). Echoed back as clientReference. Maximum 80 characters.
idempotencyKey
string
8–80 characters. Repeating a call with the same key returns the original checkout instead of creating a new one.
metadata
object
Arbitrary key-value pairs, echoed back unchanged on webhooks and retrieves.

Sample request

cURL
curl -X POST https://api.jkapay.com/v1/checkout/initialize \
  -H "Authorization: Bearer sk_test_YOUR_KEY" \
  -H "X-JKAPay-Merchant-Id: MCH_XXXXXXXXXXXX" \
  -H "Content-Type: application/json" \
  -d '{
    "amount": "150.00",
    "customer": { "email": "ama@example.com", "name": "Ama Mensah" },
    "description": "Order #12345",
    "returnUrl": "https://shop.example.com/orders/12345/thank-you",
    "callbackUrl": "https://shop.example.com/webhooks/jkapay",
    "merchantRef": "ORD-12345",
    "idempotencyKey": "ORD-12345"
  }'

Response

The checkout object is a normal transaction plus a checkoutUrl. It starts as PENDING until the customer pays.

Response201
JSON
{
  "checkout": {
    "reference": "JKA_M3A8_8F2E1B4C",
    "clientReference": "ORD-12345",
    "status": "PENDING",
    "type": "COLLECTION",
    "amount": "150.00",
    "fee": "0.00",
    "net": "0.00",
    "currency": "GHS",
    "customer": {
      "msisdn": null,
      "name": "Ama Mensah",
      "email": "ama@example.com",
      "network": null
    },
    "description": "Order #12345",
    "failureReason": null,
    "metadata": null,
    "initiatedAt": "2026-11-18T10:30:00.000Z",
    "completedAt": null,
    "checkoutUrl": "https://jkapay.com/pay/JKA_M3A8_8F2E1B4C"
  }
}

Handling the return

The customer lands on your returnUrl like this:

Shell
https://shop.example.com/orders/12345/thank-you?reference=JKA_M3A8_8F2E1B4C&clientReference=ORD-12345&status=SUCCESS
Don't trust the query string. Anyone can type a URL. Show a "thanks, we're confirming your payment" page, then confirm with GET /v1/checkout/:reference from your server, or wait for the webhook, before releasing goods.

status=CANCELLED means the customer left the checkout without paying. The checkout stays open, so the same checkoutUrl can be reused if they come back.

Webhooks

Checkout payments fire the same transaction.success / transaction.failed events as every other payment, with the same payload and signature. For card payments customer.msisdn and customer.network are null unless you supplied a phone number.

Testing. With an sk_test_… key the checkoutUrl opens a JKAPay test page instead of a real payment page. Click Pay successfully or Simulate a failed payment. You are redirected to your returnUrl and your webhook fires with "sandbox": true. No money moves. See Sandbox / test mode.

Errors

  • 400 VALIDATION_ERROR: the body failed validation, or returnUrl isn't a public URL.
  • 401 UNAUTHENTICATED: missing, malformed, or revoked API key.
  • 403 FORBIDDEN: your account is suspended or not yet approved for live payments.
  • 502 PROVIDER_ERROR: the checkout couldn't be started. Safe to retry with the same idempotencyKey.