$billing[0]->getAddress()->setLine1("1234 Main St.")->setCity("Portland")->setState("OR")->setPostalCode("97217")->setCountryCode("US");
// ### Items List
// You could provide the list of all items for
// detailed breakdown of invoice
$items = array();
$items[0] = new InvoiceItem();
$items[0]->setName("Sutures")->setQuantity(100)->setUnitPrice(new Currency());
$items[0]->getUnitPrice()->setCurrency("USD")->setValue(5);
$invoice->getPaymentTerm()->setTermType("NET_45");
// For Sample Purposes Only.
$request = clone $invoice;
// This would be refresh token retrieved from http://paypal.github.io/PayPal-PHP-SDK/sample/doc/lipp/ObtainUserConsent.html
$refreshToken = "SCNWVZfdg43XaOmoEicazpkXyda32CGnP208EkuQ_QBIrXCYMhlvORFHHyoXPT0VbEMIHYVJEm0gVf1Vf72YgJzPScBenKoVPq__y1QRT7wwJo3WYADwUW4Q5ic";
try {
    // ### Use Refresh Token. MAKE SURE TO update `MerchantInfo.Email` based on
    $invoice->updateAccessToken($refreshToken, $apiContext);
    // ### Create Invoice
    // Create an invoice by calling the invoice->create() method
    // with a valid ApiContext (See bootstrap.php for more on `ApiContext`)
    $invoice->create($apiContext);
} catch (Exception $ex) {
    // NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
    ResultPrinter::printError("Create Invoice", "Invoice", null, $request, $ex);
    exit(1);
}
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printResult("Create Invoice", "Invoice", $invoice->getId(), $request, $invoice);
// ### Send Invoice
try {
    // ### Send Invoice
    $invoice->send($apiContext);