Please do not call our service from a direct AJAX query, nor any navigator query. Because it will be rejected. Any call from an unknown or forbidden IP will be rejected… If you plan to do a request from a navigator anyway, call a script from your server which will do the request to our server…
HERE IS A PHP SAMPLE CODE FOR A SERVER-TO-SERVER CALL TO OUR SERVICE.
<?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 our redirection-url service. (IP-restricted call)
$url = 'https://usdc.nonstopay.net/api/btn-create-invoice/get/';
/*
* Data to POST
*/
$data = [
'email' => "usdc".date('His')."@nocode3.net",
'amount' => 1,
'devise ' => 'USD'
];
$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:'4 . "\n";
if( $curl->response->errorCode == 0 ){
echo 'redirectUrl: ' . $curl->response->redirectUrl . "\n";
echo 'html: ' . $curl->response->html . "\n";
}else{
echo $curl->response->errorMessage . "\n";
}
}