This repository has been archived on 2026-04-06. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
PayPal-PHP-SDK/sample/invoice/GetNextInvoiceNumber.php
Jay Patel cffa2463b1 [PSR] Fixed Tests
- Using `php-cs-fixer` tool.
2016-07-14 13:11:28 -05:00

25 lines
818 B
PHP

<?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;