Create Invoice

Create Invoice API Url

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

the price of product is under 0.4 USD will be added fee to price automaticallly

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
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 5 times, once every 3 minutes, until it reaches HTTP code 200

cancel_url String no cancel url
success_url String no success url
expiration_date Integer no, default 24 expiration date hourly

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,
'cancel_url' => 'https://yourcancelurl',
'success_url' => 'https://yoursuccessurl',
'callback_url' => 'http://yourcallbackurl',
'expiration_date' => 48
];

$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