Create an Invoice to receive a fixed amount of payment. Invoices can be used as a white-label solution or to redirect the customer to a hosted page on our system.
Forward Address
When using a forwarded address, the blockchain fees required for the transaction to be signed in the blockchain are deducted from the received amount.
Endpoint
https://anonwallet.net/api/v1/create_invoice
POST Body Parameters
Parameter | type | Example | Is Required? |
---|---|---|---|
amount | double | 0.01000000 | Yes |
currency | string | BTC | No (default is BTC) |
forward_address | string | 1Bthisisandummybitcoinaddress | No (Used to forward received amount to your specific address after is confirmed in the system) |
ipn_url | string | https://domain.com/ipn_handler | No (Used to notify you on incoming payments on callback address) Your domain must have SSL Certificate |
invoice_id | string | 12 | No (Used in case of identification in your system) |
hosted_invoice | boolean | true or 1 | No |
product_title | string | My Product Title | No (Recommended to be used in case of using the hosted invoice page feature) |
product_description | string | My Product Description | No (Recommended to be used in case of using the hosted invoice page feature) |
cancel_url | string | https://domain.com/cancel_url | No (Recommended to be used in case of using the hosted invoice page feature) Cancel button will link the buyer to your website |
success_url | string | https://domain.com/success_url | No (Recommended to be used in case of using the hosted invoice page feature) Success button will link the buyer to your website success page after a successful payment |
buyer_email | string | [email protected] | No |
Code Example
/**
* Requires libcurl
*/
$curl = curl_init();
$payload = array(
"amount" => "0.01000000",
"currency" => "BTC",
"forward_address" => "1Bthisisandummybitcoinaddress",
"ipn_url" => "https://domain.com/ipn_handler",
"invoice_id" => "12",
"hosted_invoice" => true,
);
curl_setopt_array($curl, [
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"Authorization: Bearer YOUR_API_KEY_HERE"
],
CURLOPT_POSTFIELDS => json_encode($payload),
CURLOPT_URL => "https://anonwallet.net/api/v1/create_invoice",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => "POST",
]);
$response = curl_exec($curl);
$error = curl_error($curl);
curl_close($curl);
if ($error) {
echo "cURL Error #:" . $error;
} else {
echo $response;
}
API Response
{
"status": 200,
"message": "OK",
"amount": "0.10000000",
"usd_amount":"100",
"address": "1qs2qsyzh6f64srzenpw4c2xl0twr0lc6h06tsrtzc",
"forward_address": "1Bthisisandummybitcoinaddress",
"invoice_id": 12,
"invoice_internal_id": 2722548,
"ipn_url": "domain.com/ipn_handler",
"hosted_invoice": true,
"cancel_url":"https://domain.com/cancel_url",
"success_url":"https://domain.com/success_url",
"buyer_email":"[email protected]",
"invoice_url":"https://anonwallet.net/invoice/2722548",
}