Split payments are carried out by first creating a subaccount, then initializing the split payment. Utilizing split payment is essential in scenarios where there is a shared payment between a service provider and platform provider.
Subaccount
Subaccounts can be created via using the Create Subaccount API
:
curl https://api.chapa.dev/subaccount
-H "Authorization: Bearer YOUR_SECRET_KEY"
-H "Content-Type: application/json"
-d '{ "business_name": "Cheese Sticks",
"bank_code": "058",
"account_number": "0123456789",
"percentage_charge": 0.2
}'
-X POST
Initializing Split Payment
Subaccounts can be created via the Initialize Transaction API:
curl https://api.chapa.dev/transaction/initialize
-H "Authorization: Bearer YOUR_SECRET_KEY"
-H "Content-Type: application/json"
-d '{ "email": "customer@email.com",
"amount": "20000",
"subaccount": "ACCT_xxxxxxxxx"
}'
-X POST
Bearer
When initializing a transaction, the main account carries out the charges by default. To change it to the subaccount, you must pass the param bearer: “subaccount”.
curl https://api.chapa.dev/transaction/initialize
-H "Authorization: Bearer YOUR_SECRET_KEY"
-H "Content-Type: application/json"
-d '{ "email": "customer@email.com",
"amount": "20000",
"subaccount": "ACCT_xxxxxxxxx",
"bearer": "subaccount"
}'
-X POST