Preloader

Initiate Payment

The Initiate Payment endpoint allows you to redirect users to the Zerthpay payment gateway to complete a transaction. When a valid request is sent to this endpoint, Zerthpay responds with a payment URL, which you must use to redirect the user to finalize the payment process securely. Upon successful payment, Zerthpay automatically sends a webhook notification to the merchant’s webhook URL as configured on the merchant dashboard. This ensures your system is updated in real-time with the transaction status.

Sandbox Endpoint: POST https://pay.zerth.online/pay/sandbox/api/v1/payment/create

Live Endpoint: POST https://pay.zerth.online/pay/api/v1/payment/create
reference
Parameter Type Details
amount decimal Your Amount , Must be rounded at 2 precision.
currency string Currency code (must be a valid 3-letter ISO code)
return_url: string Enter your return or success URL
cancel_url: string Enter your cancel or failed URL
reference:string Transaction id which can be used your project transaction
email: string (optional) The user's email
user_name: string (optional) The user's Full Name
                    
                        Request Example (guzzle)
                        

<?php
require_once('vendor/autoload.php');
$client = new \GuzzleHttp\Client();
$response = $client->request('POST', '{{base_url}}/pay/sandbox/api/v1/payment/create', [
'json' => [
  'amount' => '100.00',
  'currency' => 'NGN',
  'return_url' => 'www.example.com/success',
  'cancel_url' => 'www.example.com/cancel',
  'reference' => '123456789ABCD',
  'email' => '123@yahoo.com',
  'user_name' => 'Ade Obi',
 ],
'headers' => [
  'Authorization' => 'Bearer {{access_token}}',
  'accept' => 'application/json',
  'content-type' => 'application/json',
  'client-Id' => 'your Client-id',
 ],
]);
echo $response->getBody();
                    
                        
**Response: SUCCESS (200 OK)**
{
 "message": {
 "code": 200,
 "success": [
  "CREATED"
 ]
},
"data": {
 "token": "2zMRmT3KeYT2BWMAyGhqEfuw4tOYOfGXKeyKqehZ8mF1E35hMwE69gPpyo3e",
 "payment_url": "www.example.com/pay/sandbox/v1/user/authentication/form/2zMRmT3KeYT2BWMAyGhqEfuw4tOYOfGXKeyKqehZ8mF1E35hMwE69gPpyo3e",
},
"type": "success"
}
                    
                        
**Response: ERROR (403 FAILED)**
{
 "message": {
 "code": 403,
 "error": [
  "Requested with invalid token!"
 ]
},
"data": [],
"type": "error"
}