{ “errorCode”: 50002, “errorMessage” : “id required” }
{"errorCode": 0,"merchant_id": "1", "invoice_id": "1689","data": {"status": "invoice:paid","id":
1736,"devise": "USDC","amount": 5,"description": "Payment of the invoice has been made
successfully","callbackJson": null,"fiat_amount": 409.71,"fiat_currency": "INR","totalAmount":
4,“totalCurrency” : “USDC”,"datetime": "2023-04-12 19:09:48"}}
<?php
// First, please install the php-curl-class library through composer
// git repository: https://github.com/php-curl-class/php-curl-class
// Installation: composer require php-curl-class/php-curl-class
require __DIR__ . '/vendor/autoload.php';
use Curl\Curl;
$API_KEY = ''; // Your API-KEY (We sent it to you)
// URL to get an invoice status (IP-restricted call)
$url = 'https://usdc.nonstopay.net/api/invoice/status/';
/*
* Data to POST
*/
$data = [
'id' => 185
];
$curl = new Curl();
$curl->setHeader('Content-Type', 'application/json');
$curl->setHeader('API-KEY', $API_KEY);
$curl->post($url, $data);
if ($curl->error) {
echo 'Error: ' . $curl->errorMessage . "\n";
} else {
echo 'Data server received via POST:' . "\n";
if( $curl->response->errorCode == 0 ){
var_dump( $curl->response);
/*
Response example :
{
“errorCode”:0,
“merchant_id”: 1,
“invoice_id”:185,
“data”:
‘{
"status":"invoice:paid",
"id":185,
"devise":"USDC",
"amount":100,
"description":"Payment of the invoice has been made
successfully",",
"callbackJson":null,
"fiat_amount":100,
"fiat_currency":"USD",
"datetime":"2023-04-16 10:51:22"
}’
}
*/
}else{
var_dump( $curl->response);
/*
Response example :
{“errorCode”:50007, “errorMessage”: “invalid API-KEY”}
*/
}
}