This section describes the CoinsPay payment gateway API.

CoinsPay 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 CoinsPay are given below.

Currency Currency Symbol

Get The Api Key

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

To access your CoinsPay 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:

Test End Point:

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[] 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 string Required Customer's valid email 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 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 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 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 string Optional Billing country
billing_info.others string Optional Others info
Example PHP code
    $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' => '',
        'cancel_url' => '',
        'success_url' => '',
        'public_key' => 'your_public_key',
        'site_name' => 'your_site_name',
        'site_logo' => '',
        'checkout_theme' => 'light',
            'email'=>'[email protected]',

    $parameters = http_build_query($parameters);

    //live end point
    $url = '';

    //test end point
    $url = '';

    $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);

Example Responses
//Error Response.
    "status": "error",
    "message": [
        "Invalid api key"

//Success Response.
    "status": "success",
    "message": [
        "Payment initiated"
    "redirect_url": ""

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
    //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