Skip to content

Instantly share code, notes, and snippets.

@henzard
Created September 7, 2020 16:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save henzard/7a2355d333370d43baf4b5d07a6dac0b to your computer and use it in GitHub Desktop.
Save henzard/7a2355d333370d43baf4b5d07a6dac0b to your computer and use it in GitHub Desktop.
<?php
require_once(__DIR__ . '/vendor/autoload.php');
// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
// If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
// This is optional, `GuzzleHttp\Client` will be used as default.
new GuzzleHttp\Client(),
$config
);
$xero_tenant_id = YOUR_XERO_TENANT_ID; // string | Xero identifier for Tenant
$invoice_id = 00000000-0000-0000-000-000000000000; // string | Unique identifier for an Invoice
try {
$result = $apiInstance->getInvoiceHistory($xero_tenant_id, $invoice_id);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling AccountingApi->getInvoiceHistory: ', $e->getMessage(), PHP_EOL;
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment