Create an Invoice

Facades: pos

Overview

Create an invoice.

Parameters

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

See the Currency class for more information.

Example

$invoice = new Invoice(50.0, "USD");  
$invoice->setToken($bitpay->\_token);  
$invoice->setOrderId("65f5090680f6");  
$invoice->setFullNotifications(true);  
$invoice->setExtendedNotifications(true);  
$invoice->setNotificationURL("> 🚧 Note
> 
> If you get the following error when initiating the client for first time:
> 
> ```javascript 500 Internal Server Error
> {"error":"Account not setup completely yet."}
> ```
> 
> Please, go back to your BitPay account and complete the required steps.  
> More info [here](https://support.bitpay.com/hc/en-us/articles/203010446-How-do-I-apply-for-a-merchant-account-)https://hookbin.com/lJnJg9WW7MtG9GZlPVdj");
$invoice->setRedirectURL("https://hookbin.com/lJnJg9WW7MtG9GZlPVdj");
$invoice->setItemDesc("Ab tempora sed ut.");  
$invoice->setNotificationEmail("");

$buyer = new Buyer();  
$buyer->setName("Bily Matthews");  
$buyer->setEmail("");  
$buyer->setAddress1("168 General Grove");  
$buyer->setAddress2("");  
$buyer->setCountry("AD");  
$buyer->setLocality("Port Horizon");  
$buyer->setNotify(true);  
$buyer->setPhone("+990123456789");  
$buyer->setPostalCode("KY7 1TH");  
$buyer->setRegion("New Port");

$invoice->setBuyer($buyer);

$basicInvoice = $bitpay->createInvoice($invoice);

🚧

Note

If you get the following error when initiating the client for first time:

{"error":"Account not setup completely yet."}

Please, go back to your BitPay account and complete the required steps.
More info here