To start a transaction, send a POST request to the Initialize Notch Pay Payment API endpoint.
Key Constraints & Requirements:
- Mandatory Fields:
email and amount are required. - Currency Formatting: The
amount must be consistent with the currency. For example, if using XAF, the value must not contain decimals. - Reference: It is recommended to use a unique transaction identifier from your own system as the
reference. - Callback URL: You must specify a
callback URL (either in the API request or on the dashboard); otherwise, users will not be redirected back to your site after payment. - Authentication: Requests require an
Authorization header with your PUBLIC_KEY.
$url = "https://api.notchpay.co/payments/initialize";
$fields = [
'email' => "customer@email.com",
'amount' => "1000",
'currency' => "XAF",
'description' => "Payment description", // optional
'reference' => 'your_unique_reference' // optional but recommended
];
$ch = curl_init();
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",
"Cache-Control: no-cache",
));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$result = curl_exec($ch);
echo $result;