API URL:
METHOD: getrates
Get actual rates of coins.
GET
Example JSON answer:
{
"btc": {
"btc": "1",
"eth": "14.900315",
"trx": "310559.0062111801",
"ton": "15429.7176361673",
"ltc": "368.309",
"bch": "171.639",
"xrp": "39162",
"dash": "463.3254722445",
"bnb": "70.288",
"doge": "318471.3375796179",
"usdt": "19193.8579654511",
"busd": "19197.5427145325",
"dai": "19193.8579654511",
"usd": "19201.58",
"rub": "1236649",
"eur": "19743.36",
"try": "356831",
"inr": "1578972"
},
"eth": {
"btc": "0.06706181",
"eth": "1",
"trx": "20846.3623097769",
"ton": "1034.7682119205",
"ltc": "24.715759",
"bch": "11.518016",
"xrp": "2628",
"dash": "31.0714073763",
"bnb": "4.716732",
"doge": "21326.5088505012",
"usdt": "1287.5315445228",
"busd": "1287.4155133569",
"dai": "1287.6973396173",
"usd": "1288.54",
"rub": "82987",
"eur": "1324.9",
"try": "23946",
"inr": "105959"
},
{
...
}
}
METHOD: info
Get actual info about your acc.
GET
Example JSON answer:
{
"plan": "-",
"subscription": 0,
"webhooks_per_day": 0,
"requests_per_day": 0,
"rate_limit_this_method": "1 query per 10 secs"
}
METHOD: getpaylink
Request PAYLINK for customer. You need to send JSON post body to our API.
POST
Full example JSON post body:
{
"lang": "en", //required, en||ru
"title": "Title of your invoice", //required
"desc": "Decription of your invoice", //required
"amount": 60, //required, int or float, >0 (this amount will be converted by paycrypto for every coin, which does not have own amount)
"amount_currency": "usd", //required,
//[usd, rub, eur, try, inr, btc, bch, eth, usdt, trx, ltc, dash, ton, doge, dai, bnb, busd, xrp]
"ok_link": "back link for customer when transaction completed", //required, allowed: A-Z, a-z, 0-9, _.-/:?=
"cancel_link": "back link for customer when he cancel payment", //required, allowed: A-Z, a-z, 0-9, _.-/:?=
"webhook_link": "link to your script where PayCrypto will send webhook, when transaction totally get all confirmations", //required, allowed: A-Z, a-z, 0-9, _.-/:?=
"coins": { //required, list of coins, that will show on payment page
//[btc, bch, eth, ethusdt, ethdai, trx, trxusdt, ltc, dash, ton, doge, bnb, bnbdai, busd, xrp]
"ton": {
"address": "Your ton address", //required, allowed: A-Z, a-z, 0-9, -_=:
"amount": 100.002342 //optional, int or float (if you specify - paycrypto will not convert this amount)
},
"xrp": {
"address": "Your xrp address", //required, allowed: A-Z, a-z, 0-9, -_=:
"tag": 123445 //required only if coin = xrp
},
"btc": {
"address": "Your btc address" //required, allowed: A-Z, a-z, 0-9, -_=:
},
"trxusdt": {
"address": "Your trx address", //required, allowed: A-Z, a-z, 0-9, -_=:
"amount": 61 //optional, int or float (if you specify - paycrypto will not convert this amount)
} //and so on, you can use all coins, and if you want even change addresses in each request..
},
"other": { //optional, if specify - will be returned with webhook
"user_id": 12345, //any pair of key and value, key allowed: A-Z, a-z, 0-9, _, value allowed: A-Z, a-z, 0-9, _.-/:
"order_id": "pc_23482",
"something": "any string",
"and_so_on": "..."
},
"customization": {//optional, not allowed on PLAN S, allowed params: background||logo||logo_text||logo_link
"background": "fff", //or "background": "Direct link to image", optional (you can use colors without # or images), allowed: A-Z, a-z, 0-9, _.-/:
"logo": "Direct link to image", //optional, allowed: A-Z, a-z, 0-9, _.-/:
"logo_text": "Custom header of invoice", //optional, allowed: A-Z, a-z, 0-9, _.-/:
"logo_link": "Direct link to your project" //optional, allowed: A-Z, a-z, 0-9, _.-/:
}
}
PHP example:
<?php
$json['lang'] = 'en';
$json['title'] = 'Test invoice #123';
$json['desc'] = 'Custom description for my invoice';
$json['amount'] = 60;
$json['amount_currency'] = "eur"; //look coins list
$json['ok_link'] = "https://paycrypto.global/docs";
$json['cancel_link'] = "https://paycrypto.global";
$json['webhook_link'] = "https://paycrypto.global/my_script_for_incoming_webhooks";
//$json['coins'] = ARRAY of coins (you can use all in each invoice)
//customer sees these coins as different payment methods on invoice page
//you can set ..[coin]['address'], ..[coin]['amount'], ..[coin]['tag'] (tag - only for xrp)
//look coins list
$json['coins']['btc']['address'] = "mybtcaddress1234";
$json['coins']['trx']['address'] = "myTRXaddress";
$json['coins']['trx']['amount'] = 1579.123456; //optional
//if you specify amount paycrypto will not convert $json['amount'] for this coin
$json['coins']['trxusdt']['address'] = "myTRXaddress";
$json['coins']['xrp']['address'] = "myXRPaddress";
$json['coins']['xrp']['tag'] = 19384532;
//$json['other'] = ARRAY of key->value (PayCrypto will add this info in webhook)
//$json['other']['your_key'] = 'your_value';
$json['other']['customer_id'] = 129483435;
$json['other']['password'] = 'abc34de56';
$json['other']['product_id'] = 'book_145';
//customization NOT available on plan S
$json['customization']['background'] = 'https://paycrypto.global/assets/img/custom-bg-1.svg';
$json['customization']['logo'] = 'https://paycrypto.global/assets/img/logo.png';
$json['customization']['logo_text'] = 'PayCrypto Store';
$url = "https://paycrypto.global/api/***your_api_key***/getpaylink";
$content = json_encode($json);
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_HEADER, false);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_HTTPHEADER, ["Content-type: application/json"]);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, $content);
$json_response = curl_exec($curl);
curl_close($curl);
$decode_answer = json_decode($json_response, true);
$pay_link = $decode_answer['paylink'];
//show link to customer and so on...
?>
Example JSON answer:
{
"paylink": "https://paycrypto.global/invoice/pwc0e30lclswr5t"
}
Coins list (for API)
JSON[amount_currency]
usd, rub, eur, try, inr, btc, bch, eth, usdt, trx, ltc, dash, ton, doge, dai, bnb, busd, xrp
JSON[coins][coin ]
btc, bch, eth, ethusdt, ethdai, trx, trxusdt, ltc, dash, ton, doge, bnb, bnbdai, busd, xrp
WEBHOOKS (notifications)
When transaction gets all required confirmations, PayCrypto will send webhook (POST query with JSON in body) to your script.
We send webhooks only from these IPs: 92.255.107.43, 185.119.56.59, 185.178.44.137, 185.178.46.40, 185.178.47.148, 185.178.47.161 Example of webhook (json, post):
{
"shop_amount": 60, //amount of your invoice
"shop_currency": "rub", //currency of your invoice
//[usd, rub, eur, try, inr, btc, bch, eth, usdt, trx, ltc, dash, ton, doge, dai, bnb, busd, xrp]
"customer_amount": "0.000000100", //amount paid by your customer
"customer_currency": "ton", //customer's currency
//[btc, bch, eth, usdt, trx, ltc, dash, ton, doge, dai, bnb, busd, xrp]
"input_wallet": "your address", //your address that got transaction
"input_tx_hash": "transaction hash", //transaction id
"other": {
"user_id": 12345,
"order_id": "pc_23482",
"something": "any string"
},
"webhook_link": "Direct link to your script" //just dublicate
}
PHP example:
<?php
if (!in_array($_SERVER['REMOTE_ADDR'], ['92.255.107.43', '185.119.56.59', '185.178.44.137', '185.178.46.40', '185.178.47.148', '185.178.47.161'])) exit;
//block other IPs
$input = file_get_contents('php://input');
//get JSON from paycrypto
$decode = json_decode($input, 1);
//decode JSON from paycrypto
//top up balance, or make something for your customer here using information from $decode array
?>