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. PAYOUT API Documentation

V- 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:

FOR FUNDS

Status
Nature of the notification
Description
Type

status

fund:created

Received when you create a funds

string

fund:success

Received when tx_hash is correct

string

fund:failed

Received when an error occurred.

string

fund:pending

Pending fund

string

devise

currency symbol of the funds = USDC or OSDT

string

amount

decimal amount of the funds

decimal

id

ID of the sale

integer

description

Describe the status

string

merchant_data

The data you send us with merchant_data parameter

string

failed_reason

The reason for the FAILED status

string

FOR PAYMENT

Status
Nature of the notification
Description
Type

status

payment:pending

Received when payment is pending

string

payment:success

Received when payment is successful

string

payment:failed

Received when an error occurred.

string

devise

currency symbol of the payment

string

amount

decimal amount of the payment

float

id

ID of the sale

Integer

description

Describe the status

string

merchant_data

The data you send us with merchant_data parameter

string

failed_reason

The reason for the FAILED status

string

Response examples:

{
  "status": "fund:success",
  "id": "35",
  "currency": "USDC",
  "amount": "5",
  "description": "The funds has been correctly placed",
  "merchant_data": {
    "id": "my personnal data"
  }
}
{
  "status": "payment:failed",
  "id": "84",
  "amount": "3",
  "currency": "EUR",
  "description": "The payment is in FAILED status",
  "merchant_data": {
    "txId": "qktr12eqzg",
    "status": "sfrt"
  },
  "failed_reason" : "General bank decline"
}

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'];
$currency = $_POST['currency'];
$amount = foatval($_POST['amount']);
$description = $_POST['description'];
$callbackJson = $_POST['merchant_data'];
//—---- 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,
    'currency' => $currency,
    '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
}
PreviousIV-PAYOUT PAYMENTNextGuide for Affiliate

Last updated 2 months ago