Create an Invoice

Facades: pos

Overview

Create an invoice.

Parameters

ParameterDescription
amountAmount to invoice the buyer.
currencyThe currency for the invoice.

Example

📘

Note

In this example, we assume that a Client has already been initialized and assigned to the bitpay variable.

Create an invoice

Invoice invoice = bitpay.createInvoice(new Invoice(100.0, "USD"));
String invoiceUrl = invoice.Url;
String status = invoice.Status;

Create an invoice (extended)

You can add optional attributes to the invoice. Atributes that are not set are ignored or given default values.

Buyer buyerData = new Buyer();
buyerData.setName("Satoshi");
buyerData.setAddress1("street");
buyerData.setAddress2("911");
buyerData.setLocality("Washington");
buyerData.setRegion("District of Columbia");
buyerData.setPostalCode("20000");
buyerData.setCountry("USA");
buyerData.setEmail("[email protected]");
buyerData.setNotify(true);

Invoice invoice = new Invoice(100.0, Currency.USD)
invoice.setBuyer(buyerData);

invoice = bitpay.createInvoice(invoice);