Hosted Checkout
Create a checkout session, redirect the customer, and verify the payment.
Hosted checkout lets customers complete payment on Chapa's checkout page. Your backend initializes the payment and receives a checkout_url.
Initialize checkout
POST /v2/payments/hosted
Host: api.chapa.global
Authorization: Bearer <PRIVATE_KEY>
Content-Type: application/json
Idempotency-Key: <UNIQUE_OPERATION_KEY>Reuse the same idempotency key when retrying an operation. Use a new key for a new payment.
Request fields
| Field | Required | Description |
|---|---|---|
amount | Yes | Integer cents, minimum 100 |
currency | Yes | Currency enabled for the payment method |
merchant_reference | No | Unique merchant reference, maximum 20 characters |
preferred_payment_methods | No | Array of preferred payment method slugs |
customer | No | Customer details |
callback_url | No | HTTPS callback URL |
return_url | No | HTTPS URL to return the customer to |
subaccounts | No | Array of payment split rules |
meta | No | Custom metadata |
customization | No | title, description, and logo |
The customer object accepts first_name, last_name, email, phone_number, and card_number.
10000 represents 100 ETB when the currency is ETB. Retrieve Payment Methods to check enabled methods and currency limits.
For cURL, set PRIVATE_KEY in your shell. Set IDEMPOTENCY_KEY for this operation and reuse it on retries. Replace the placeholders in the JavaScript example before running it.
{
"amount": 10000,
"currency": "ETB",
"merchant_reference": "ref-1791192600",
"preferred_payment_methods": [
"telebirr"
],
"customer": {
"first_name": "Abebe",
"last_name": "Kebede",
"email": "abebe.kebede@example.com",
"phone_number": "251911000000"
},
"callback_url": "https://example.com/chapa/callback",
"return_url": "https://example.com/chapa/return",
"meta": {
"order_id": "ORD-1001"
},
"customization": {
"title": "Order #1001",
"description": "Payment for order 1001",
"logo": "https://example.com/logo.png"
}
}curl -X POST 'https://api.chapa.global/v2/payments/hosted' \
-H "Authorization: Bearer $PRIVATE_KEY" \
-H "Idempotency-Key: $IDEMPOTENCY_KEY" \
-H "Content-Type: application/json" \
-d '{
"amount": 10000,
"currency": "ETB",
"merchant_reference": "ref-1791192600",
"preferred_payment_methods": [
"telebirr"
],
"customer": {
"first_name": "Abebe",
"last_name": "Kebede",
"email": "abebe.kebede@example.com",
"phone_number": "251911000000"
},
"callback_url": "https://example.com/chapa/callback",
"return_url": "https://example.com/chapa/return",
"meta": {
"order_id": "ORD-1001"
},
"customization": {
"title": "Order #1001",
"description": "Payment for order 1001",
"logo": "https://example.com/logo.png"
}
}'const response = await fetch("https://api.chapa.global/v2/payments/hosted", {
method: "POST",
headers: {
"Authorization": "Bearer <PRIVATE_KEY>",
"Idempotency-Key": "<IDEMPOTENCY_KEY>",
"Content-Type": "application/json"
},
body: JSON.stringify({
"amount": 10000,
"currency": "ETB",
"merchant_reference": "ref-1791192600",
"preferred_payment_methods": [
"telebirr"
],
"customer": {
"first_name": "Abebe",
"last_name": "Kebede",
"email": "abebe.kebede@example.com",
"phone_number": "251911000000"
},
"callback_url": "https://example.com/chapa/callback",
"return_url": "https://example.com/chapa/return",
"meta": {
"order_id": "ORD-1001"
},
"customization": {
"title": "Order #1001",
"description": "Payment for order 1001",
"logo": "https://example.com/logo.png"
}
})
});
const data = await response.json();
console.log(data);{
"status": "success",
"message": "Payment initiated successfully",
"data": {
"checkout_url": "https://checkout.chapa.global/CH0Vn2VASWCi",
"created_at": "2026-10-05T09:30:00Z",
"expires_at": "2026-10-06T09:30:00Z"
}
}{
"status": "error",
"message": "Idempotency-Key header is required for payment operations",
"error": {
"code": "MISSING_REQUIRED_FIELD",
"details": null
}
}{
"status": "error",
"message": "Invalid API key or User does not exist",
"error": {
"code": "UNAUTHORIZED",
"details": null
}
}{
"status": "error",
"message": "API key environment does not match business environment.",
"error": {
"code": "INVALID_VALUE",
"details": null
}
}{
"status": "error",
"message": "Merchant reference has been used before",
"error": {
"code": "INVALID_STATE",
"details": null
}
}{
"status": "error",
"message": "Failed to marshal subaccounts",
"error": {
"code": "PROCESSING_FAILED",
"details": null
}
}Redirect and store the reference
Redirect the customer to the returned data.checkout_url. Store that URL and your merchant_reference. The final path segment of the checkout URL is the Chapa payment reference. Store created_at and expires_at if you need to track checkout validity.
Use the returned URL directly; do not construct a checkout URL from a hardcoded host.
Verify before fulfillment
After a redirect or notification, your server calls:
GET /v2/payments/{paymentReference}/verify
Authorization: Bearer <PRIVATE_KEY>The path accepts either the Chapa reference or your merchant reference. Fulfill only when data.status === "SUCCESS", the amount and currency match the order, and the reference belongs to the expected payment attempt. Top-level status: "success" means the API operation succeeded, not that the customer paid.
Continue the integration
- Verify Payments: confirm a payment's current state.
- Payment Split Rules: distribute a payment to subaccounts.
- Payment Webhooks: handle asynchronous notifications.
- HTML Checkout: use hosted checkout from a form.