How to send Receipts to Xero using calcinai/xero-php - Laravel?
Get the solution ↓↓↓I am trying to send a receipt (bill/ expense) as a draft to the Xero, but what ever I try and do, I am getting an error. Basically, I want to upload the receipt( the invoice sent by the supplier), enter the Name of the supplier, Amount to pay, Invoice Number from the supplier and our reference code merged (eg: Inv Num / Ref as 987/ 123), due date, and a small description like 1 dozen blue ball pens. Can you please guide me how to solve this issue please.
$invoice= new \XeroPHP\Models\Accounting\Receipt();
$xcontact= new \XeroPHP\Models\Accounting\Contact();
$xcontact->setName('Test Contact');
$xcontact->setFirstName('Test');
$xcontact->setLastName('Contact');
$xcontact->setEmailAddress('[email protected]');
$xcontact->setDefaultCurrency('AUD');
$invoice->setContact($xcontact);
// till the above code, things are working fine but having issues here)
$invoice->setTotal('300.00');
$dateInstance = new DateTime();
$invoice->setDate($dateInstance);
$invoice->setReceiptNumber('987/');
$invoice->setReference('123');
i was trying to send the info but giving me an error as:
Call to undefined method XeroPHP\Models\Accounting\Receipt::setReceiptNumber()
and if comment the setReceiptNumber(); I get the following error as:
XeroPHP\Models\Accounting\Receipt::$LineItems is mandatory and is either missing or empty.
Not too sure how can I send the Bills to the Xero.
Thanks for your time.
Answer
Solution:
UsesendEmail()
function to send email.
$invoice->sendEmail();
Share solution ↓
Additional Information:
Link To Answer People are also looking for solutions of the problem: a non-numeric value encountered
Didn't find the answer?
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Similar questions
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.