Create an Invoice

Facades POS MERCHANT

Overview

Create an invoice.

Example

const invoice = new Invoice(10.0, 'USD');
invoice.notificationEmail = '[email protected]';
invoice.notificationURL = 'https://some-url.com';

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

invoice.buyer = buyer

const createdInvoice = await client.createInvoice(invoice);
const client = Client.createPosClient('somePosToken');

const invoice = new Invoice(10.0, 'USD');
invoice.notificationEmail = '[email protected]';
invoice.notificationURL = 'https://some-url.com';

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

invoice.buyer = buyer

const createdInvoice = await client.createInvoice(invoice);

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