To get your account statistics, send a POST request to the following URL:
Statistics of payments for particular period
POST
https://api.cryptocloud.plus/v2/invoice/merchant/statistics
You will receive invoice statistics for the specified period by submitting this request.
Request Body
200: OK Successful response
Copy {
"status" : "success" ,
"result" : {
"count" : {
"all" : 59 ,
"created" : 41 ,
"paid" : 16 ,
"overpaid" : 1 ,
"partial" : 1 ,
"canceled" : 0
} ,
"amount" : {
"all" : 4683.83 ,
"created" : 3032.63 ,
"paid" : 1531.0 ,
"overpaid" : 100.2 ,
"partial" : 20.0 ,
"canceled" : 0
}
}
}
Response parameters description
A successful request receives a response with status success and object result.
count — an object that contains values for the number of invoices.
amount — an object that contains values for the invoice amounts in USD.
created — invoices with the status «Created».
paid — invoices with the status «Paid».
overpaid — invoices with the status «Overpaid».
partial — invoices with the status «Partially paid».
canceled — invoices with the status «Canceled».
Request examples
These examples show how you can submit a request to get statistics. Note that you need to provide your API key in the Authorization
header to successfully authorize the request.
cURL Python JavaScript PHP
Copy curl -X POST https://api.cryptocloud.plus/v2/invoice/merchant/statistics \
-H "Authorization: Token <API KEY>" \
-H "Content-Type: application/json" \
-d '{"start":"01.01.2023","end":"31.01.2023"}'
Copy import requests
url = "https://api.cryptocloud.plus/v2/invoice/merchant/statistics"
headers = {
"Authorization" : "Token <API KEY>"
}
data = {
"start" : "01.01.2023" ,
"end" : "31.01.2023"
}
response = requests . post (url, headers = headers, json = data)
if response . status_code == 200 :
print ( "Success:" , response. json ())
else :
print ( "Fail:" , response.status_code, response.text)
Copy fetch ( 'https://api.cryptocloud.plus/v2/invoice/merchant/statistics' , {
method : 'POST' ,
headers : {
'Authorization' : 'Token <API KEY>' ,
'Content-Type' : 'application/json'
} ,
body : JSON .stringify ({
start : '01.01.2023' ,
end : '31.01.2023'
})
})
.then (response => {
if ( response .ok) {
return response .json ();
} else {
throw new Error ( 'Fail: ' + response .status + ' ' + response .statusText);
}
})
.then (data => console .log ( 'Success:' , data))
.catch (error => console .error ( 'Error:' , error));
Copy <? php
$ch = curl_init () ;
curl_setopt ( $ch , CURLOPT_URL , "https://api.cryptocloud.plus/v2/invoice/merchant/statistics" ) ;
curl_setopt ( $ch , CURLOPT_RETURNTRANSFER , 1 ) ;
curl_setopt ( $ch , CURLOPT_POST , 1 ) ;
curl_setopt ( $ch , CURLOPT_POSTFIELDS , json_encode ( array(
"start" => "01.01.2023" ,
"end" => "31.01.2023"
) )) ;
$headers = array (
"Authorization: Token <API KEY>" ,
"Content-Type: application/json"
);
curl_setopt ( $ch , CURLOPT_HTTPHEADER , $headers ) ;
$response = curl_exec ( $ch ) ;
if ( curl_errno ( $ch ) ) {
echo 'Error:' . curl_error ( $ch ) ;
} else {
$statusCode = curl_getinfo ( $ch , CURLINFO_HTTP_CODE ) ;
if ($statusCode == 200 ) {
echo "Success: " . $response;
} else {
echo "Fail: " . $statusCode . " " . $response;
}
}
curl_close ( $ch ) ;
?>
Last updated 10 months ago