Split Payments
In a nutshell
Implementing split payments involves:
Create a subaccount
Subaccounts can be created via the Paystack Dashboard or using the create subaccountAPI endpoint. When a subaccount is created, the subaccount_code
is returned.
1curl https://api.paystack.co/subaccount2-H "Authorization: Bearer YOUR_SECRET_KEY"3-H "Content-Type: application/json"4-d '{ "business_name": "Cheese Sticks",5 "bank_code": "058",6 "account_number": "0123456789",7 "percentage_charge": 0.28 }'9-X POST
1{2 "status": true,3 "message": "Subaccount created",4 "data": {5 "business_name": "Cheese Sticks",6 "account_number": "0123456789",7 "percentage_charge": 0.2,8 "settlement_bank": "Guaranty Trust Bank",9 "integration": 428626,10 "domain": "test",11 "subaccount_code": "ACCT_xxxxxxxxxxxxx",12 "is_verified": false,13 "settlement_schedule": "AUTO",14 "active": true,15 "migrate": false,16 "id": 37614,17 "createdAt": "2020-05-19T11:54:20.655Z",18 "updatedAt": "2020-05-19T11:54:20.655Z"19 }20}
Verify Account Number
Initialize a split payment
Split payments can be initialized by using the Initialize TransactionAPI endpoint and passing the parameter subaccount: "SUB_ACCOUNTCODE"
.
1curl https://api.paystack.co/transaction/initialize2-H "Authorization: Bearer YOUR_SECRET_KEY"3-H "Content-Type: application/json"4-d '{ "email": "customer@email.com",5 "amount": "20000",6 "subaccount": "ACCT_xxxxxxxxx"7 }'8-X POST
1{2 "status": true,3 "message": "Authorization URL created",4 "data": {5 "authorization_url": "https://checkout.paystack.com/nkdks46nymizns7",6 "access_code": "nkdks46nymizns7",7 "reference": "nms6uvr1pl"8 }9}
Split payments can be used in the following scenario:
- Shared payment between service provider and platform provider
- Split profit between different vendors
- Separate school fees in different account e.g. Tuition, Accomodation, Excursion
Flat Fee
By default, payments are split by percentage. For example, if a subaccount was created with percentage_charge: 0.2
, 20% goes to the subaccount and the rest goes to the main account.
However, you can override this default and specify a flat fee that goes into your main account. To do this, pass the transaction_charge
key when intializing a transaction.
In the snippet below, the main account gets a flat fee of 10000
and the subaccount gets the rest:
1curl https://api.paystack.co/transaction/initialize2-H "Authorization: Bearer YOUR_SECRET_KEY"3-H "Content-Type: application/json"4-d '{ "email": "customer@email.com",5 "amount": "20000",6 "subaccount": "ACCT_xxxxxxxxx",7 "transaction_charge": 100008 }'9-X POST
1{2 "status": true,3 "message": "Authorization URL created",4 "data": {5 "authorization_url": "https://checkout.paystack.com/nkdks46nymizns7",6 "access_code": "nkdks46nymizns7",7 "reference": "nms6uvr1pl"8 }9}
Bearer of Transaction Fee
By default, the Paystack charges are borne by the main account. To change this to a subaccount, pass the param bearer: "subaccount"
while intializing a transaction.
1curl https://api.paystack.co/transaction/initialize2-H "Authorization: Bearer YOUR_SECRET_KEY"3-H "Content-Type: application/json"4-d '{ "email": "customer@email.com",5 "amount": "20000",6 "subaccount": "ACCT_xxxxxxxxx",7 "bearer": "subaccount"8 }'9-X POST
1{2 "status": true,3 "message": "Authorization URL created",4 "data": {5 "authorization_url": "https://checkout.paystack.com/nkdks46nymizns7",6 "access_code": "nkdks46nymizns7",7 "reference": "nms6uvr1pl"8 }9}
Invalid Split Configuration
400 Bad Request
error.