Initialize
Streamline your customer payments with Notch Pay's Payout API.
When you initiate a transfer request, it undergoes a series of automated steps to ensure security and successful completion. Here's a breakdown of the process:
- Request Validation: The system thoroughly examines your request to verify it includes all the necessary information and adheres to any predefined rules or limitations.
- Transfer Creation: Once validated, your request is transformed into a formal transfer record within the system, containing details like sender, recipient, and amount.
- Approval Checks: Depending on the transfer amount or internal policies, the request might require approval from a designated authority before proceeding.
- Await Processor: Finally, the transfer reaches the front of the queue and is sent to the payment processor for execution. The system then awaits a response from the processor regarding the transfer's success or failure.
Step 1: Collect transfers information
In order to commence the transaction, you need to create recipient or get his id.
Step 2: Initialize Transfer
To initiate the transfer, send a request to our API using the collected transfer details, ensuring to include your secret key for authorization.
- The
amount
field must be consistent with the currency you wish to use. If for example you use XAF, this value must not contain a decimal value - The
currency
The currency of the transfer. - The
description
The reason of the transfer. - The
recipient
The reference id of recipient.
Example request
$url = "https://api.notchpay.co/transfers";
$fields = [
'recipient' => "rcp.mmO5DI6r9EuBdm4U",
'amount' => "10",
'currency' => "XAF",
'description' => "At et veniam ut laboriosam aut sint id voluptas.", // this field is optional
];
//open connection
$ch = curl_init();
//set the url, number of POST vars, POST data
curl_setopt($ch,CURLOPT_URL, $url);
curl_setopt($ch,CURLOPT_POST, true);
curl_setopt($ch,CURLOPT_POSTFIELDS, $fields);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
"Authorization: PUBLIC_KEY",
"X-Grant: PRIVATE_KEY",
"Cache-Control: no-cache",
));
//So that curl_exec returns the contents of the cURL; rather than echoing it
curl_setopt($ch,CURLOPT_RETURNTRANSFER, true);
//execute post
$result = curl_exec($ch);
echo $result;
Example response
{
"status": "Accepted",
"message": "Transfer initialized",
"code": 201,
"transfer": {
"amount": 10,
"amount_total": 11,
"sandbox": false,
"fee": 1,
"converted_amount": 10,
"beneficiary": "rcp.mmO5DI6r9EuBdm4U",
"description": "At et veniam ut laboriosam aut sint id voluptas.",
"reference": "po.rKI4eJBYkebUAKj5stAHeCCnLyV8NZy9",
"trxref": null,
"statement": null,
"status": "sent",
"currency": "XAF",
"geo": "127.0.0.1",
"created_at": "2024-06-17T21:35:51.000000Z"
}
}
Step 3: Upon Transfer Completion (Success or Failure):
Four actions will occur:
- Webhook Notification (if enabled): You'll receive a notification via webhook. Refer to our webhooks guide for details and examples.
- Email Notification (unless disabled): You'll receive an email notification regarding the transfer.
- Server-Side Verification: You can verify the transaction using our API and the transaction ID.
- Failed Transfer Notification (webhooks only): If webhooks are enabled, you'll receive separate notifications for each failed transfer. This allows you to contact customers or take further action as needed. Our webhooks guide provides an example.