Bulk Transfers
You can send money to multiple recipients in one go using the Chapa’s bulk transfers API
.
How to make a bulk payment
To do this, you'll provide an array of objects called e bulk_data
. Each item in this array contains details for one transfer—the same details you specify when making a single transfer.
You can also specify a title for the transfer. This is helpful so you can easily identify what a set of payments was for.
Keep in Mind!!!!
Each object in the bulk_data array is the same parameters for a single transfer request. A batch should not contain more than 100 items and each batch should be sent every 5 seconds. The duration is to avoid getting rate limited. Sending multiple requests at short intervals would lead to a 429 (Too many requests) error.
With your batch properly planned and implemented, you can now initiate the bulk transfer.
Here is a sample code for bulk transactions:
Endpoint https://api.chapa.co/v1/bulk-transfers
Method POST
Authorization
: Pass your secret key as a bearer token in the request header to authorize this call.
import requests import json url = "https://api.chapa.co/v1/bulk-transfers" payload = json.dumps({ "title": "This Month Salary!", "currency": "ETB", "bulk_data": [ { "account_name": "Israel Goytom", "account_number": "09xxxxxxxx", "amount": 1, "reference": "b1111124", "bank_code": 128 }, { "account_name": "Israel Goytom", "account_number": "09xxxxxxxx", "amount": 1, "reference": "b2222e5r", "bank_code": 128 } ] }) headers = { 'Content-Type': 'application/json', 'Authorization': 'Bearer CHASECK-xxxxxxxxxxxxxxxx' } response = requests.request("POST", url, headers=headers, data=payload) print(response.text)
The transfers will be queued for processing, which usually take between a few seconds.
Checking the status
You can also check the status of a bulk transfer manually using the get all transfers endpoint with a batch_id query parameter. The batch_id is the data.id returned from the create bulk transfer response:
Here is a sample code for checking the status:
Endpoint https://api.chapa.co/v1/transfers?batch_id=<id>
Method GET
Authorization
: Pass your secret key as a bearer token in the request header to authorize this call.
import requests url = "https://api.chapa.co/v1/transfers?batch_id=1" payload = "" headers = { 'Authorization': 'Bearer CHASECK-xxxxxxxxxxxxxxxx' } response = requests.request("GET", url, headers=headers, data=payload) print(response.text)