Introduction

This section describes the Big4Pay payment gateway API.


Big4Pay The PaymentHub API is simple to integrate into your company's software. Our API takes cURL requests, has well-formatted URLs, and produces JSON responses.

The API can be used in test mode without affecting your real data. The request is authenticated using the API key, which also establishes whether the payment is legitimate or not. For test mode just use the sandbox URL and In case of live mode use the live URL from section Initiate Payment .

Supported Currencies

The supported currencies by Big4Pay are given below.


Currency Currency Symbol
USD USD
EUR EUR

Get The Api Key

How to obtain the api key is explained in this part.


To access your Big4Pay merchant account, please log in. In case you don't have an account, you can Click Here.

Now go to the Account > Settings > API Key from the merchant panel.

The api keys can be found there which is Public key and Secret key. Use these keys to initiate the API request. Every time you can generate new API key by clicking Generate Api Key button. Remember do not share these keys with anyone.

Initiate Payment

In this section, the procedure for initiating the payment is explained.


To begin the payment process, use the sample code provided, and pay close attention to the parameters. The API endpoints mentioned below will need to be used to make the request.

Live End Point: https://big4pay.com/payment/initiate

Test End Point: https://big4pay.com/test/payment/initiate

Request to the end point with the following parameters below.

Param Name Param Type Description
public_key string (50) Required Your Public API key
identifier string (20) Required Identifier is basically for identify payment at your end
currency string (4) Required Currency Code, Must be in Upper Case. e.g. USD,EUR
amount decimal Required Payment amount
details string (100) Required Details of your payment or transaction
ipn_url string Required The url of instant payment notification
success_url string Required Payment success redirect url
cancel_url string Required Payment cancel redirect url
site_name string Required Your business site name
site_logo string/url Optional Your business site logo
checkout_theme string Optional Checkout form theme dark/light. Default theme is light
Customer
customer[] array Required customer must be an array
customer.first_name string Required Customer's first name
customer.last_name string Required Customer's last name
customer.email string Required Customer's valid email
customer.mobile string Required Customer's valid mobile
Shipping info
shipping_info[] array Optional shipping_info must be an array
shipping_info.address_one string Optional Customer's address one
shipping_info.address_two string Optional Customer's address two
shipping_info.area string Optional Shipping area of customer
shipping_info.city string Optional Shipping city of customer
shipping_info.sub_city string Optional Shipping sub city of customer
shipping_info.state string Optional Shipping state
shipping_info.postcode string Optional Shipping postcode
shipping_info.country string Optional Shipping country
shipping_info.others string Optional Others info
Billing info
billing_info[] array Optional billing_info must be an array
billing_info.address_one string Optional Customer's address one
billing_info.address_two string Optional Customer's address two
billing_info.area string Optional Billing area of customer
billing_info.city string Optional Billing city of customer
billing_info.sub_city string Optional Billing sub city of customer
billing_info.state string Optional Billing state
billing_info.postcode string Optional Billing postcode
billing_info.country string Optional Billing country
billing_info.others string Optional Others info
Example PHP code
<?php
    $parameters = [
        'identifier' => 'DFU80XZIKS',
        'currency' => 'USD',
        'amount' => 11.00,
        'gateway_methods' => [
            // Please write the name of the gateway method you want to use
        ],
        'details' => 'Purchase T-shirt',
        'ipn_url' => 'http://example.com/ipn_url.php',
        'cancel_url' => 'http://example.com/cancel_url.php',
        'success_url' => 'http://example.com/success_url.php',
        'public_key' => 'your_public_key',
        'site_name' => 'your_site_name',
        'site_logo' => 'http://yoursite.com/logo.png',
        'checkout_theme' => 'light',
        'customer'=>[
            'first_name'=>'John',
            'last_name'=>'Doe',
            'email'=>'joan@gmail.com',
            'mobile'=>'12345789',
        ],
        'shipping_info'=>[
            'address_one'=>'',
            'address_two'=>'',
            'area'=>'',
            'city'=>'',
            'sub_city'=>'',
            'state'=>'',
            'postcode'=>'',
            'country'=>'',
            'others'=>'',
        ],
        'billing_info'=>[
            'address_one'=>'',
            'address_two'=>'',
            'area'=>'',
            'city'=>'',
            'sub_city'=>'',
            'state'=>'',
            'postcode'=>'',
            'country'=>'',
            'others'=>'',
        ]
    ];

    $parameters = http_build_query($parameters);

    //live end point
    $url = 'https://big4pay.com/payment/initiate';

    //test end point
    $url = 'https://big4pay.com/test/payment/initiate';

    $ch = curl_init();
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_POSTFIELDS,  $parameters);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    $result = curl_exec($ch);
    curl_close($ch);

?>
Example Responses
//Error Response.
{
    "status": "error",
    "message": [
        "Invalid api key"
    ]
}

//Success Response.
{
    "status": "success",
    "message": [
        "Payment initiated"
    ],
    "redirect_url": "https://example.com/payment/checkout?payment_trx=eyJpdiI6IkFyNllSNU1lOFdkYTlPTW52cytPNGc9PSIsInZhbHVlIjoiWWowRTRjdzZ1S1BBRm4ydS81OWR1WjdXeFIxcjE1WkZRVE9BcmZYeXpzND0iLCJtYWMiOiJjNDdhODUzYzY2NmZlZGJjZTI5ODQyMmRkYzdjYjRmM2NiNjg4M2RiMWZjN2EyMzFkODI4OWMwYjk3ZWYwNGQwIiwidGFnIjoiIn0%3D"
}

Validate The Payment and IPN

This section describes the process to get your instant payment notification.


To initiate the payment follow the example code and be careful with the perameters. You will need to make request with these following API end points.

End Point: Your business application ipn url.

Request Method: POST

You will get following parameters below.

Param Name Description
status Payment success status.
identifier Identifier is basically for identify payment at your end.
signature A hash signature to verify your payment at your end.
data Data contains some basic information with charges, amount, currency, payment transaction id etc.
Example PHP code
<?php
    //Receive the response parameter
    $status = $_POST['status'];
    $signature = $_POST['signature'];
    $identifier = $_POST['identifier'];
    $data = $_POST['data'];

    // Generate your signature
    $customKey = $data['amount'].$identifier;
    $secret = 'YOUR_SECRET_KEY';
    $mySignature = strtoupper(hash_hmac('sha256', $customKey , $secret));

    $myIdentifier = 'YOUR_GIVEN_IDENTIFIER';

    if($status == "success" && $signature == $mySignature &&  $identifier ==  $myIdentifier){
        //your operation logic
    }
?>

We may use cookies or any other tracking technologies when you visit our website, including any other media form, mobile website, or mobile application related or connected to help customize the Site and improve your experience. learn more

Allow