0

I'm simply trying to implement an event that creates an invoice on Xero everytime a payment is processed on Laravel backend. Its been 3 days now trying to install their SDK, many non official packages and I still don't understand how to do that. Their documentation is so bad, I don't understand everything with Xero either.

Question: What should I be looking for to achieve what I want? All guides and docs explain how to connect some sort of third party users with my Xero account, using oAuth2, a callback, getting tenants and such, I have found nothing about just using their API to create a new invoice to my own Xero account.

Everything I said might be plain gibberish, if so, please correct me.

Best Regards

  • 1
    You will need to implement OAuth2 in order to do what you want. It's not as terrible as it sounds, though I haven't done it from PHP as I use VB myself. I found the APIs quite difficult to understand and just do HTTP POST calls to the appropriate endpoint when I need to send a contact, invoice, payment or whatever to Xero. Have you had a browse down here, I am sure there are working PHP examples that have been provided in response to questions. There is also the Xero developers forum and some examples on Github. – droopsnoot Apr 28 '21 at 17:14

1 Answers1

4

Xero now has an official PHP SDK available on GitHub.

https://github.com/XeroAPI/xero-php-oauth2

A developer in our community created a wrapper for Laravel https://github.com/XeroAPI/xero-php-oauth2#laravel

This starter project shows how to handle the OAuth2 flow https://github.com/XeroAPI/xero-php-oauth2-starter

and a video showing how to use the starter project https://www.youtube.com/watch?v=vc1d7vdWeOE

We have SDK reference docs with runnable code examples as well https://xeroapi.github.io/xero-php-oauth2/docs/v2/accounting/index.html

I hope the above resources help