Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set invoice to 'Paid' via Xero payments API #99

Open
pixel-paul opened this issue Sep 14, 2022 · 9 comments
Open

Set invoice to 'Paid' via Xero payments API #99

pixel-paul opened this issue Sep 14, 2022 · 9 comments

Comments

@pixel-paul
Copy link

Hi,

Thanks for providing this plugin, it is (almost!) exactly what we need.

We have two additional requirements:

  1. Mark an invoice as paid if a successful transaction has been made (e.g. via credit card).
    https://developer.xero.com/documentation/api/accounting/payments

  2. Send an invoice via Xero (instead of via CiviCRM)
    https://developer.xero.com/documentation/api/accounting/invoices

I am assuming that this functionality does not exist yet?

Many thanks,

Paul

@eileenmcnaughton
Copy link
Owner

In the first case- do you mean it would already be paid in CiviCM & then pushed up to Xero as paid - I think @agileware-fj added a setting that does that.

I'm not aware of any work having been done on sending invoices via Xero

@pixel-paul
Copy link
Author

pixel-paul commented Sep 14, 2022

do you mean it would already be paid in CiviCM & then pushed up to Xero as paid

Yes, exactly.

I'm not aware of any work having been done on sending invoices via Xero

OK, thanks, I'll look into this a little more.

@Upperholme
Copy link

In my set-up, at .../civicrm/xero/settings there are options to set the status of contributions that will trigger a push up to Xero (see at the bottom of the attached screenshot). I'm assuming that by setting 'completed ' as one of these statuses, when a contribution gets marked as complete, that change is pushed up to Xero and the relevant invoice is marked as paid. In my case our book-keeper is recording payments in Xero first, and those changes certainly reflect back into Civi.

Screenshot 2022-09-14 at 12 08 12

@pixel-paul
Copy link
Author

pixel-paul commented Sep 14, 2022

that change is pushed up to Xero and the relevant invoice is marked as paid

When I have tested this with 'Xero Default Invoice Status' set to 'Draft', the invoice would need to be 'Approved', and if I set it to 'Approved', the invoice is set to 'Awaiting Payment' in Xero. This still requires a manual step of applying a payment.

@petednz
Copy link
Contributor

petednz commented Sep 14, 2022

I may not understand your point, but in Xero you need to do a 'reconciliation' in order to join the incoming info from your bank/cc to the existing info about the trxn which civi has already pushed to xero. happy to be put right by Eileen but I don't know if it is possible to sidestep the need to do the physical reconciliation in Xero

@agileware-fj
Copy link
Contributor

agileware-fj commented Sep 15, 2022

The API lets you set an invoice as PAID when it's submitted, but our patch to automatically authorise didn't include this - on the assumption that people would be doing bank reconciliations as @petednz described.

The reasoning for this is that people will want Xero to have records of income they actually have rather than what's been promised by a CC gateway. I'm not sure whether there's a different between an invoice which is just paid and an invoice that's been reconciled - so will leave that alone.

On a more technical note, implementing a PAID as a status is a little more involved than what we did as you'd want to be sure that you're only submitting invoices with a status that maps correctly to what's in CiviCRM - currently the "default" status is actually what's sent through for every invoice.

@pixel-paul
Copy link
Author

I have pretty much completed the modifications we required to make this work. One of the complicated parts was that the Payment API is not within the Xero library being used, so I had to add this in. Is there a plan to move to the Xero SDK?

Once I was able to post to the Payment end point, I was able to update the record in Xero with the total using the Invoice ID. This then marks the invoice as 'Paid'.

Sending the invoice via email requires posting to the Invoice endpoint with the invoice ID (again I had to add this in to the Xero library).

I still need to work on the error handling and responses within the Xero library and also the front end UI to manage these features.

No idea if this is useful to anyone, however, if you'd like me to do a PR, I can once I have tidied things up a little more.

@eileenmcnaughton
Copy link
Owner

@pixel-paul I think we generally agree that switching to the Xero SDK would be better - but no-one has put the time into investigating it.

@mattwire has also been working on some improvements in this space.

I suspect the ability to send an invoice would be popular

@mattwire
Copy link
Contributor

Yes it would be nice to switch to Xero SDK and would not be a huge job but is more than just a couple of tweaks because you'd be replacing the oauth stuff and all the communication with Xero. I'd say probably a couple of days work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants