Create Invoice

Create Invoice API Endpoint

POST https://payid19.com/api/v1/create_invoice

Requests

Parameters to be sent to the service are as follows:

Input Name Type Required Description
public_key String Yes your public key
private_key String Yes your private key
test Integer No, default null if the value is 1 it is a test invoice, if the value is null it is a live invoice
email String No Email or buyer.
merchant_id String No ID of merchant.
order_id String No ID of order.
customer_id Integer No ID of buyer.
price_amount Decimal Yes price of product
price_currency String No, default USD Currency (default: USD). Alternatively, you can set USD, EUR, GBP and other currencys, show all supported currencies
add_fee_to_price Integer no, default null if the value is 1 add fee to price

*when used, it increases erroneous transfers and decreases sales.

title String no title of invoice
description String no description of invoice
banned_coins NEW JSON no Coins that you do not want to use to receive payments.

example: ["BTC","ETH","USDT-ERC20"]

*Bitcoin, Ethereum and USDT-ERC20 addresses are not give to your customers.

example 2: ["USDT","BNB"]

*USDT (all network)and Bnb addresses are not give to your customers.

callback_url String no Merchant callback URL for payment result notification if payment success

result values is :private_key(for compare yours), id, email, merchant_id, order_id, customer_id, price_amount, price_currency, amount, amount_currency, add_fee_to_price, title, description, ref_url, cancel_url, success_url, callback_url, ip, test, created_at, expiration_date

Tries 3 times, once every 5 minutes, until it reaches HTTP code 200

It requires a public domain(not ip address and localhost), if you dont have one yet you can use ngrok or webhook.site for testing.

cancel_url String no cancel url
success_url String no success url
expiration_date Integer no, default 12, max 12 expiration date hourly
margin_ratio Integer no We've seen people send a lot of underpaid amounts (usually under 1 USDd) as getting paid in crypto is a new payment method. The amount you write in this field is ignored and the payment is considered successful, even if it is missing. for example: if you type 1 (1 USDT) here and generate an invoice to receive payment of 5 USDT, the payment will be considered successful even if you receive 4 USDT, but your customer will be considered unsuccessful if the payment is 3.9 USDT (If you typed 2, 3.9 USDT would also be considered successful.)
white_label NEW Integer no To create an invoice with your own logo, your own style and brand, send it as 1 and receive a list of coins you can receive payment from as JSON. For detailed information and More

Response

Parameters to be returned from the service are as follows:

Input Name Type Description
status String success or error
message String error message if status is error or invoice url if status is success

Sample Codes


Create Invoice Sample

<?php
$url= 'https://payid19.com/api/v1/create_invoice';

$post = [
'public_key' => 'yourpublickey',
'private_key' => 'yourprivatekey',
'email' => '[email protected]',
'price_amount' => 725,
'price_currency' => 'USD',
'merchant_id' => 5,
'order_id' => 11,
'customer_id' => 12,
'test' => 1,
'title' => 'title',
'description' => 'description',
'add_fee_to_price' => 1,
//'banned_coins' => json_encode(array("BTC", "ETH", "USDT-ERC20")),
'cancel_url' => 'https://yourcancelurl',
'success_url' => 'https://yoursuccessurl',
'callback_url' => 'http://yourcallbackurl',
'expiration_date' => 12,
'margin_ratio' => 1.5
//'white_label' => 1
];

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS,http_build_query($post));
$result = curl_exec($ch);
curl_close($ch);

if(json_decode($result)->status=='error'){
//error
echo json_decode($result)->message[0];
}else{
//success
echo json_decode($result)->message;
}

Catch Callback Sample

<?php
$data = json_decode(file_get_contents('php://input')); //catch request data

if($data->privatekey!="your privatekey"){ //compare private keys
die;
}
....and the other things
Are you a developer? Please look at our New Developer Referral Program , Earn %50.