More Invoice API Updates

This commit is contained in:
japatel
2014-11-18 16:50:57 -06:00
parent e6fb968509
commit 383d12622b
11 changed files with 357 additions and 1209 deletions

View File

@@ -0,0 +1,31 @@
<?php
// # Update Invoice Sample
// This sample code demonstrate how you can update
// an invoice.
/** @var Invoice $invoice */
$invoice = require 'CreateInvoice.php';
use PayPal\Api\Invoice;
// ### Update Invoice
// Lets update some information
$invoice->setInvoiceDate("2014-11-16 PST");
// For Sample Purposes Only.
$request = clone $invoice;
try {
// ### Update Invoice
// Update an invoice by calling the invoice->update() method
// with a valid ApiContext (See bootstrap.php for more on `ApiContext`)
$invoice->update($apiContext);
} catch (Exception $ex) {
ResultPrinter::printError("Invoice Updated", "Invoice", null, $request, $ex);
exit(1);
}
ResultPrinter::printResult("Invoice Updated", "Invoice", $invoice->getId(), $request, $invoice);
return $invoice;