API Reference
Transactions are the main way to transfer funds between merchants and customers. The following types of transactions are supported:
Cashin (Deposit)
Request that funds be deposited into your merchant account.
Path
${BASE_URL}/transactions/cashin
Request Headers
Field | Type | Description |
---|---|---|
Accept | string | application/json |
Content-Type | string | application/json |
Idempotency-Key | string | Optional Unique String with maxLength of 32 for each request |
Authorization | string | Bearer <access_token> |
X-Webhook-Mode | string | Specify your current environment associated with the webhook. |
Body
Field | Type | Description |
---|---|---|
amount | number | The amount to be deposited. |
number | string | The phone number of the customer. |
Example
cURL
curl --location --request POST \
'https://payments.paypack.rw/api/transactions/cashin' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer {access_token}' \
--data-raw '{ "amount": 100, "number": "078xxxxxxx"}'
Response
{
"amount": 1000,
"created_at": "2005-11-09T21:19:07.459Z",
"kind": "CASHIN",
"ref": "d0bb2807-1d52-4795-b373-3feaf63dceb1",
"status": "pending"
}
Cashout (Withdraw)
Request that money be withdrawn from your merchant account.
Path
/transactions/cashout
Request Headers
Field | Type | Description |
---|---|---|
Accept | string | application/json |
Content-Type | string | application/json |
Idempotency-Key | string | Optional Unique String with maxLength of 32 for each request |
Authorization | string | Bearer <access_token> |
X-Webhook-Mode | string | Specify your current environment associated with the webhook. |
Body
Field | Type | Description |
---|---|---|
amount | number | The amount to be withdrawn. |
number | string | The phone number of the customer. |
Example
cURL
curl --location --request POST \
'https://payments.paypack.rw/api/transactions/cashout' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer {access_token}' \
--data-raw '{ "amount": 1000, "number": "078xxxxxxx" }'
Response
{
"amount": 1000,
"created_at": "2005-11-09T21:19:07.459Z",
"kind": "CASHOUT",
"ref": "d0bb2807-1d52-4795-b373-3feaf63dceb1",
"status": "pending"
}
Both Cashin and Cashout support idempotency-key as an optional header with unique string of 32 char length, which means that if you didn't set the header, we will generate a unique string for you.
Finding a Transaction
Transactions are identified by their unique reference key, which is generated during its creation.
Path
/transactions/find/{ref}
Request Headers
Field | Type | Description |
---|---|---|
Accept | string | application/json |
Content-Type | string | application/json |
Authorization | string | Bearer <access_token> |
Query Parameters
Field | Type | Description |
---|---|---|
ref | string | The unique reference key of the transaction. |
Example
cURL
curl --location --request GET \
'https://payments.paypack.rw/api/transactions/find/{ref}' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer {access_token}'
Response
{
"amount": 1000,
"client": "078xxxxxxx",
"fee": 23,
"kind": "CASHOUT",
"merchant": "IJOK9F",
"ref": "d0bb2807-1d52-4795-b373-3feaf63dceb1",
"status": "pending",
"timestamp": "2014-05-16T08:28:06.801064-04:00"
}
What is Idempotency-key?
- Idempotency key is a unique identifier that can be used to ensure that a certain request can only be executed once. This is particularly useful when dealing with financial transactions, where it is important to avoid duplicate charges or refunds.
- In the case of Paypack-Payments, an idempotency key can be used to prevent multiple payments from being made for the same request. For example, if you attempts to cashin/cashout twice due to a network error or other issue, the second attempt will be rejected by the Paypack-Payments API and you will not be charged twice.
- We recommends using a unique and randomly generated idempotency key for each request made to the API. This ensures that even if there are multiple requests with the same idempotency key, only the first request will be executed, avoiding any accidental duplicate charges or other issues.