forked from LiveCarta/PayPal-PHP-SDK
Updated Invoicing APIs
- Updated Model objects. - Updated Samples. - Updated Tests.
This commit is contained in:
24
sample/invoice/GetNextInvoiceNumber.php
Normal file
24
sample/invoice/GetNextInvoiceNumber.php
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
// # Get Next Invoice Number Sample
|
||||
// This sample code demonstrate how you can retrieve
|
||||
// the next invoice number.
|
||||
|
||||
require '../bootstrap.php';
|
||||
use PayPal\Api\Invoice;
|
||||
|
||||
// ### Get Next Invoice Number
|
||||
// To generate the successive invoice number for the merchant, use below code.
|
||||
// (See bootstrap.php for more on `ApiContext`)
|
||||
try {
|
||||
$number = Invoice::generateNumber($apiContext);
|
||||
} catch (Exception $ex) {
|
||||
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
|
||||
ResultPrinter::printError("Get Next Invoice Number", "InvoiceNumber", null, null, $ex);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
|
||||
ResultPrinter::printResult("Get Next Invoice Number", "InvoiceNumber", null, $number, $number);
|
||||
|
||||
return $number;
|
||||
Reference in New Issue
Block a user