ChapaChapa Docs

Accept Payment

Learn how to accept payments from your customers using Chapa's API. Initialize transactions and handle the complete payment flow.

When accepting a payment, a transaction is established and following every transaction carries out a complete payment method.

Collecting Customer Information

Before carrying out the transaction, a user must provide required information such as full name, email address, the amount to transfer, etc.

Required Fields

ParameterDescription
amountThe amount you will be charging your customer
phone_numberRequired for high-risk businesses

Optional Fields

ParameterDescription
emailA customer's email address
first_nameA customer's first name
last_nameA customer's last name
phone_numberThe customer's phone number
callback_urlFunction that runs when payment is successful
return_urlWeb address to redirect the user after payment
customization[title]Custom title for the payment modal
tx_refA unique reference given to each transaction
currencyCurrency for charges (ETB or USD)

Phone number is not required, but if you pass phone_number, it must be 10 digits in 09xxxxxxxx or 07xxxxxxxx format.

Initialize the Transaction

Once all the information needed to proceed with the transaction is retrieved, initialize the transaction to get a payment link.

Endpoint: https://api.chapa.co/v1/transaction/initialize

Method: POST

Pass your secret key as a bearer token in the Authorization header.

JSON
cURL
JavaScript
PHP
Python

Redirect to Payment

Redirect your customer to the link returned in data.checkout_url, and we'll display our checkout modal for them to complete the payment.

After the Payment

When payment is successful, four things will happen:

  1. Redirect: We'll redirect to your set return_url if configured
  2. Callback: The callback_url will receive status, ref_id, and tx_ref
  3. Webhook: We'll send you a webhook if you have that enabled. See Webhooks
  4. Email: We'll send you an email notification (unless disabled)

On your server, you should handle the redirect and always verify the final state of the transaction.

Callback Response Structure

When the payment is completed, the callback_url will receive a GET request with:

{
  "trx_ref": "chewatatest-6669",
  "ref_id": "APqDvYw1okk2",
  "status": "success"
}
ParameterDescription
trx_refThe unique transaction reference you provided
ref_idChapa's internal reference ID
statusTransaction status: "pending", "success", "failed", etc.

Next Steps

On this page