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 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 => json

Status
Type
Value
Label
Description

status

string

invoice:created

CREATED

CREATED : The transaction was successfully created

string

invoice:opened

OPENED

OPENED : The transaction was successfully created and client redirected to paiement page

string

invoice:paid

PAID

After the payment settlement, we will pay the transaction by transferring the corresponding USDT crypto amount on POLYGON to your ERC20 wallet and we will change the status to invoice:paid

string

invoice:failed

FAILED

Received when an error occurred.

string

invoice:awaiting_approval

WAITING SETTLEMENT

The payment made by the customer is successful. In this case, you can already credit his balance

string

invoice:chargeback

CHARGEBACK

Chargeback

string

invoice:withheld

WITHHELD

Withheld

devise

string

currency symbol. for now = USD

amount

decimal

decimal amount in USD

id

integer

ID of the sale

description

string

Describe the status

callbackJson

string

The data you send us with callbackJson parameter

Response examples:

{ “status”: “invoice:paid”, “devise”: “USD”, “amount”: “1500.00”, “id”:
“15515”,“description”: “Invoice paid”, “callbackJson”:”{\”txId\” : \”qktr12eqzg\”, \”status\” :
\”sfrt\”}” }

{ “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- INTEGRATIONNextPAYIN NFT API Documentation

Last updated 2 months ago