{ “errorCode”: 50002, “errorMessage” : “id required” }
{"errorCode":0,"status":"PAID","from":"2023-06-01","to":"2023-06-19","page":2,
"order":"DESC","list":[ {"id":"1932", "email":"email@gmail.com",
"status":"PAID","amount":"1.00", "symbol":”USD”, "create_date":"2023-06-15 10:39:34",
"status_date":"2023-06-15 10:40:38","tx_hash":
"0xda4fd344e6310738db73dabdb42a213a38f14d2379b13c27fe86f8452002d4c5",
"exchange_currency_symbol":"USDC","paid_amount":"1.00",
"merchant_amount":"0.900","fee_amount":"0.100", "ip":"102.177.124.254","country":"United
Arab Emirates","success_url":null,"pending_url":null, "cancel_url":null} ],"total":"51"}
<?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/invoices/history/';
/*
* Data to POST
*/
$data = [
'status' => 'PAID',
'from' => '2023-06-01',
'to' => '2023-06-19',
'order' => 'ASC',
'page' => 2,
];
$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,
"status":"PAID",
"from":"2023-06-01",
"to":"2023-06-19",
"page":2,
"order":"DESC",
"list":[
{
"id":"1932",
"email":"email@gmail.com",
"status":"PAID","amount":"1.00",
"symbol":”USD”,
"create_date":"2023-06-15 10:39:34",
"status_date":"2023-06-15 10:40:38",
"tx_hash":
"0xda4fd344e6310738db73dabdb42a213a38f14d2379b13c27fe86f8452002d4c5",
"exchange_currency_symbol":"USDC",
"paid_amount":"1.00",
"merchant_amount":"0.900",
"fee_amount":"0.100",
"ip":"102.117.124.254",
"country":"United Arab Emirates",
"success_url":null,
"pending_url":null,
"cancel_url":null}
],
,"total":"51"
}
*/
}else{
var_dump( $curl->response);
/*
Response example :
{“errorCode”:50007, “errorMessage”: “invalid API-KEY”}
*/
}
}