Chapa
Start here

Quick Start

Get up and running with Chapa API v2 in minutes with this step-by-step guide.

This quick start walks you through the simplest end-to-end payment flow using Chapa API v2:

Initialize payment → Redirect customer → Verify payment

This flow applies to Hosted Checkout, which is the recommended starting point.

Step 1: Create a Chapa Account

Create (or sign in to) your merchant account on the Chapa Dashboard.

Register for a Chapa merchant account

From the dashboard, you'll be able to:

  • Manage API keys
  • Switch between Test and Live modes
  • View payments, payouts, refunds, and webhooks

Step 2: Use Test Mode for Development

Chapa supports two environments:

ModeDescription
Test ModeNo real money is moved
Live ModeReal transactions

Always start in Test mode while building and validating your integration. Switch to Live mode only when you're ready to accept real payments.

Do not mix test and live keys — this will cause authentication errors.

Step 3: Get Your API Keys

From your dashboard, navigate to:

Settings → API Keys

You'll find:

Key TypeUsage
Private KeyUsed on your server to authorize API requests. Never expose this in frontend code.
Public KeyUsed only for client-side integrations (e.g., Inline.js)

Step 4: Prepare Payment Details

Before initializing a payment, collect the required payment information.

Required Parameters

ParameterDescription
amountAmount in integer cents, minimum 100
currencySupported currency code

Supported Currencies

CodeCurrency
USDUS Dollar
UGXUgandan Shilling
ETBEthiopian Birr
DJFDjiboutian Franc
ParameterDescription
merchant_referenceYour unique payment reference, maximum 20 characters
customerCustomer details object
customer.first_nameCustomer's first name
customer.last_nameCustomer's last name
customer.emailCustomer's email address
customer.phone_numberCustomer's phone number
preferred_payment_methodsArray of preferred payment methods
metaInternal metadata (order ID, notes)

Phone number is required for some payment methods and high-risk businesses and must follow international format (e.g., +251960724272).

Step 5: Initialize the Payment (Server-Side)

Call the Hosted Payment endpoint from your backend to generate a checkout URL.

Endpoint:

POST https://api.chapa.global/v2/payments/hosted

Headers:

Authorization: Bearer <CHAPA_PRIVATE_KEY>
Content-Type: application/json
Idempotency-Key: <UNIQUE_OPERATION_KEY>
Example Request

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.

JSON
{
  "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
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"
  }
}'
JavaScript
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);

Step 6: Redirect the Customer to Checkout

If initialization is successful, Chapa returns a checkout URL:

Example Response
200 Success
{
  "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"
  }
}
400 Error
{
  "status": "error",
  "message": "Idempotency-Key header is required for payment operations",
  "error": {
    "code": "MISSING_REQUIRED_FIELD",
    "details": null
  }
}
401 Error
{
  "status": "error",
  "message": "Invalid API key or User does not exist",
  "error": {
    "code": "UNAUTHORIZED",
    "details": null
  }
}
403 Error
{
  "status": "error",
  "message": "API key environment does not match business environment.",
  "error": {
    "code": "INVALID_VALUE",
    "details": null
  }
}
409 Error
{
  "status": "error",
  "message": "Merchant reference has been used before",
  "error": {
    "code": "INVALID_STATE",
    "details": null
  }
}
500 Error
{
  "status": "error",
  "message": "Failed to marshal subaccounts",
  "error": {
    "code": "PROCESSING_FAILED",
    "details": null
  }
}

Redirect your customer to checkout_url to complete the payment on Chapa's hosted checkout page.

Step 7: Listen for Post-Payment Signals

After the customer completes (or abandons) the payment, Chapa may notify you via:

  • Redirect back to your application (if configured)
  • Webhook events (recommended)
  • Dashboard updates

Important: Redirects and webhooks are signals only. You must still verify the payment on your server before fulfilling the order.

Step 8: Verify the Payment Before Fulfillment

Confirm the payment status by verifying the transaction on your server. Use your merchant reference or the Chapa payment reference, which you can find at the end of checkout_url or in the payment webhook payload.

Endpoint:

GET https://api.chapa.global/v2/payments/{paymentReference}/verify
Example Request

For cURL, set PRIVATE_KEY in your shell. Replace the placeholders in the JavaScript example before running it.

cURL
curl -X GET 'https://api.chapa.global/v2/payments/CH0Vn2VASWCi/verify' \
  -H "Authorization: Bearer $PRIVATE_KEY"
JavaScript
const response = await fetch("https://api.chapa.global/v2/payments/CH0Vn2VASWCi/verify", {
  method: "GET",
  headers: {
  "Authorization": "Bearer <PRIVATE_KEY>"
},
});
const data = await response.json();

console.log(data);

Example Successful Response:

Example Response
200 Success
{
  "status": "success",
  "message": "Payment verification result",
  "data": {
    "chapa_reference": "CH0Vn2VASWCi",
    "merchant_reference": "ref-1759656600",
    "amount": 10000,
    "currency": "ETB",
    "status": "SUCCESS",
    "payment_method": "telebirr",
    "processor_reference": "TB123456789",
    "service_fee": 300,
    "customer": {
      "first_name": "Abebe",
      "last_name": "Kebede",
      "email": "abebe.kebede@example.com",
      "phone_number": "251911000000"
    },
    "created_at": "2026-10-05T09:30:00Z",
    "updated_at": "2026-10-05T09:30:00Z"
  }
}
400 Error
{
  "status": "error",
  "message": "Customer not found",
  "error": {
    "code": "NOT_FOUND",
    "details": null
  }
}
401 Error
{
  "status": "error",
  "message": "Invalid API key or User does not exist",
  "error": {
    "code": "UNAUTHORIZED",
    "details": null
  }
}
403 Error
{
  "status": "error",
  "message": "API key environment does not match business environment.",
  "error": {
    "code": "INVALID_VALUE",
    "details": null
  }
}
404 Error
{
  "status": "error",
  "message": "Payment not found",
  "error": {
    "code": "NOT_FOUND",
    "details": null
  }
}

Before fulfillment, confirm data.status === "SUCCESS" and match the amount, currency, and payment reference to the expected order. Only then should you:

  • Mark the order as paid
  • Deliver goods or services
  • Update your internal records

Best Practices

Do

  • Always verify payments server-side
  • Use authenticated webhooks to trigger server-side verification
  • Use unique merchant_reference values
  • Use idempotency keys for retries

Don't

  • Never trust frontend success alone
  • Never expose private keys in client-side code

Next Steps

On this page