Tuesday, March 21, 2017

PHP Xero Laravel Record Payments

I am using the Xero Laravel wrapper (https://github.com/amochohan/xerolaravel) and want to record payments made against an invoice. I can get the invoice but cannot find how to record a payment using the Laravel Wrapper provided;

I have tried a couple of solutions but none seem to work;

// Load the Invoice (Working)
$invoice = XeroPrivate::loadByGUID('Accounting\\Invoice', 'RPT445-1');

$payment = \App::make('XeroPayment');
$payment->setInvoice($invoice);
$payment->setDate(Carbon::now());
$payment->setAmount(100);

$xero->save($payment);

The above returns the issue

Class XeroPayment does not exist

Can anyone help? I can find the Xero documentation but this doesn't help to how it could translate into Laravel. It may be that the wrapper doesn't have this functionality built in, if so how would I complete using https://github.com/calcinai/xero-php which the wrapper is based on?



via Kieran Headley

Advertisement