NONSTOPAY Documentations
DocumentationNonstopay
  • PAYIN API Documentation
    • I-PREREQUISITE
    • II-HOW TO USE THE API
      • Create invoice CREDIT CARD (POST)
      • Create invoice UPI (POST)
      • Create invoice CRYPTO (POST)
      • Get an invoice status (GET)
      • Get invoice infos (GET)
      • Get invoice history (GET)
      • Get crypto payable currencies (GET)
    • III- INTEGRATION
    • IV- Webhook notification (callbacks)
  • PAYIN NFT API Documentation
    • I-PREREQUISITE
    • II-HOW TO USE THE API
      • NFT - Create invoice (POST)
      • NFT - Get an invoice status (GET)
      • NFT - Get invoice infos (GET)
      • NFT - Get invoice history (GET)
    • III- INTEGRATION
    • IV- Webhook notification (callbacks)
  • PAYOUT API Documentation
    • I-PREREQUISITE
    • II- INTEGRATION
    • III-PAYOUT FUNDS
    • IV-PAYOUT PAYMENT
    • V- Webhook notification (callbacks)
  • Guide for Affiliate
    • Registration and login
    • Features
  • Guide to Smart Settlement
    • Registration and login
    • Features
    • Whitelabel
  • Payment Crypto > Payable currencies value list
  • External Links
Powered by GitBook
On this page
  1. PAYIN NFT API Documentation

IV- Webhook notification (callbacks)

If you have set up a callback url in your dashboard, then you will receive a notification on each payment operation made from our services. You can receive failure or success notifications. Here is the information you will receive for our callback server :

  • Header parameter:

    • ‘X-Signature’ => string

      • This signature is used to verify the notification really comes from us

      • Check the PHP code below to see how to verify the signature.

    • Content-Type: application/json

  • POST response variables:

Status
Nature of the notification
Description
Type

status

invoice:created

Received when you create an sale in your dashboard

string

invoice:opened

Received when you create an sale in your dashboard and you redirected to paiement page

string

invoice:paid

Received when an sale has been fully paid

string

invoice:failed

Received when an error occurred.

string

invoice:awaiting_approval

The payment made by the customer has been successful

string

invoice:charge back

Chargeback

string

invoice:withheld

Withheld

string

devise

currency symbol. for now = USD

string

amount

decimal amount in USD

decimal

id

ID of the sale

integer

description

Describe the status

string

callbackJs on

The data you send us with callbackJson parameter

string

Response examples:

{
   "status":"invoice:paid",
   "devise":"USD",
   "amount":"1500.00",
   "id":"15515",
   "description":"Invoice paid",
   "callbackJson"::"{\"txId\" : \"qktr12eqzg\", \"status\" : \"sfrt\"}",
   "nft_info": {
	  "id" : "155150001",
	  "ipfs_url" : "https://ipfs.nonstopay.net/polygon/155150001"
   }
}
{
   "status":"invoice:awaiting_approval",
   "devise":"USD",
   "amount":"1500.00",
   "id":"15515",
   "description":"Waiting settlement",
   "callbackJson"::"{\"txId\" : \"qktr12eqzg\", \"status\" : \"sfrt\"}",
   "nft_info": {
	  "id" : "155150001",
	  "ipfs_url" : "https://ipfs.nonstopay.net/polygon/155150001"
   }
}
{
   "status":"invoice:failed",
   "description":"An error occurred",
   "id":"15515",
   "callbackJson":"{\"txId\" : \"qktr12eqzg\", \"status\" : \"sfrt\"}"
}

NB: Notification Callback will originate from the IP address 85.206.160.33

HERE IS AN EXAMPLE TO HANDLE CALLBACK NOTIFICATIONS:

//—---- Get POST PARAM
$id = intval($_POST['id']);
$status = $_POST['status'];
$devise = $_POST['devise'];
$amount = foatval($_POST['amount']);
$description = $_POST['description'];
$callbackJson = $_POST['callbackJson'];
//—---- Get signature
$signatureKey = 'X-Signature';
$headers = array();
if (function_exists('apache_response_headers')) {
    $headers = apache_request_headers();
}
else {
    foreach($_SERVER as $key => $value) {
        if (substr($key,0,5) == "HTTP_") {
            $key = str_replace(" ", "-",
            ucwords(strtolower(str_replace('_', ' ',
            substr($key,5)))));
            $headers[$key] = $value;
        }
    }
}
$signature = $headers[$signatureKey];
$DATA_SECURITY_HASH = $headers[$signatureKey];
$hashData = hash_hmac('sha256',
json_encode(['id' => $id,
    'amount' => $amount,
    'devise' => $devise,
    'status' => $status]),
    $YOUR_API_KEY) ; // $YOUR_API_KEY => API KEY is to be copied as in the image block above.
// Check data
if( hash_equals($hashData, $signature) ){
    // OK. You can insert/update the data
}else{
    // KO
}
PreviousIII- INTEGRATIONNextPAYOUT API Documentation

Last updated 2 months ago