3

I am using xero for generate invoice, now I want get invoice using xero invoice id in php, my code is ...........

$nik = $xero->load('Accounting\\Invoice')
      ->where('InvoiceID', $outwardRecord->xero_invoice_id)
       or 
      ->where('InvoiceID', \XeroPHP\Models\Accounting\Invoice::InvoiceID)
      ->execute();

but it's given error

Fatal error: Undefined class constant 'InvoiceID' in /var/w

please guide me how to get invoice using invoiceId, how understand my problem.

thanks!

Neeraj Prajapati
  • 541
  • 5
  • 24

1 Answers1

1

thanks to all,

finally I got answer,

$xero_api_config = getCustomConfigItem('xero_api_config');
$xero = new \XeroPHP\Application\PrivateApplication($xero_api_config);
$response=$xero->loadByGUID('Accounting\\Invoice',$xero_invoice_id);
print_r($response);

it's working!

Neeraj Prajapati
  • 541
  • 5
  • 24