Server to Server Bank Transfer

Overview

Process bank transfers directly through your server using Cashonrails S2S APIs.

Integration Steps

  1. List Available Banks
  2. Initialize Bank Transfer
  3. Verify Transaction
  4. Cancel Transaction

Each step has specific requirements. Follow the detailed guides below for implementation.

Base URL

https://mainapi.cashonrails.com/api/v1/s2s

1. List Available Banks

Retrieve list of available banks for transfer:

curl --location '{{baseurl}}/banktransfer/list' \
--header 'Authorization: Bearer YOUR_SECRET_KEY'

Sample Response:

{
    "status": true,
    "message": "Banks retrieved successfully",
    "data": [
        {
            "name": "Wema Bank",
            "code": "wema",
            "logo": "https://..."
        }
        // ... other banks
    ]
}

2. Initialize Bank Transfer

Initialize a bank transfer transaction:

curl --location '{{baseurl}}/banktransfer/initialize' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer YOUR_SECRET_KEY' \
--data-raw '{
    "email": "test@email.com",
    "amount": "100",
    "currency": "NGN",
    "reference": "{{reference}}",
    "provider": "wema"
}'
ParameterTypeRequiredDescription
emailstringYesCustomer’s email address
amountstringYesAmount to transfer
currencystringYesCurrency code (e.g., NGN)
referencestringYesUnique transaction reference
providerstringYesBank code from banks list

Sample Response:

{
    "status": true,
    "message": "Transfer initialized successfully",
    "data": {
        "reference": "COR_202402210123456789",
        "account_number": "1234567890",
        "account_name": "CASHONRAILS/TEST",
        "bank_name": "Wema Bank",
        "amount": "100",
        "currency": "NGN"
    }
}

3. Verify Transaction

Always verify the transaction status:

curl -X GET '{{baseurl}}/transaction/verify/{reference}' \
-H "Authorization: Bearer YOUR_SECRET_KEY"

Sample Response:

{
    "status": true,
    "message": "Transaction verified successfully",
    "data": {
        "reference": "COR_202402210123456789",
        "amount": "100",
        "currency": "NGN",
        "status": "success",
        "payment_method": "bank_transfer"
    }
}
⚠️

Always verify transaction status before confirming payment. Bank transfers may take a few minutes to complete.

4. Cancel Transaction

You can cancel a transaction that is still pending or in progress:

curl -X GET {{baseurl}}/transaction/cancel/{reference} \
-H "Authorization: Bearer YOUR_SECRET_KEY"

Replace {reference} with your transaction reference.

Cancellation Rules
⚠️
  • Only pending or processing transactions can be cancelled
  • Completed transactions cannot be cancelled (use refund instead)
  • Failed transactions are already inactive and don’t need cancellation
  • Once cancelled, a transaction cannot be resumed