Facades: pos
, merchant
Overview
Create an invoice.
Parameters
Parameter | Description |
---|---|
amount | Amount to invoice the buyer. |
currency | The currency for the invoice. See the Currency class for more information. |
Example
$invoice = new Invoice(50.0, Currency::USD); //Always use the included Currency model to avoid typos
$invoice->setToken($bitpay->_token);
$invoice->setOrderId("65f5090680f6");
$invoice->setFullNotifications(true);
$invoice->setExtendedNotifications(true);
$invoice->setNotificationURL("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);
$invoice = new Invoice(50.0, Currency::USD); //Always use the included Currency model to avoid typos
$invoice->setToken($bitpay->_token);
$invoice->setOrderId("65f5090680f6");
$invoice->setFullNotifications(true);
$invoce->setExtendedNotifications(true);
$invoice->setNotificationURL("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, Facade::POS, false);
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