Create an Invoice

Facades POS MERCHANT

Overview

Create an invoice.

Example

let buyer = new Buyer();
buyer.email = "[email protected]";
buyer.name = "Bily Matthews";
buyer.address1 = "168 General Grove";
buyer.address2 = "";
buyer.locality = "Port Horizon";
buyer.region = "New Port";
buyer.postalCode = "KY7 1TH";
buyer.country = "AD";
buyer.phone = "+990123456789";
buyer.notify = true;

let invoiceData = new BitPaySDKLight.Models.Invoice(6.02, Currencies.USD);
invoiceData.buyer = buyer;
invoiceData.orderId = '65f5090680f6';
invoiceData.fullNotifications = true;
invoiceData.extendedNotifications = true;
invoiceData.notificationURL = "https://hookb.in/1gw8aQxYQDHj002yk79K";
invoiceData.redirectURL = "https://hookb.in/1gw8aQxYQDHj002yk79K";
invoiceData.itemDesc = 'Ab tempora sed ut.';
invoiceData.notificationEmail = '[MERCHANT EMAIL ADDRESS]';

let invoice;

invoice = await client.CreateInvoice(invoiceData);

WARNING:
If you get the following error when initiating the client for first time:
"500 Internal Server Error` response: {"error":"Account not setup completely yet."}"
Please, go back to your BitPay account and complete the required steps.
More info here