Join us at Xero Developer Roadshow, June 2018 at a city near you. Register Free

Payment services integration


The online invoicing functionality within Xero presents some great opportunities for Xero customers to utilize payments services to streamline the payments process and more effectively manage their cashflow.

Background: video overview of sales & online invoicing in Xero.


Payment services that integrate with Xero and pass our standard Add-­on partner review process, will become an official Xero Add-­on partner and will be promoted in the Xero Add­-on directory.

The steps to become a certified Xero Add-­on partner are outlined in our partner page - ­ this includes the initial marketing requirements to promote the application as an official Xero Add­on partner.

Online invoicing & API

Use the 'custom url' option to connect the payment button on Xero online invoices to an external web address.

Once configured, the ‘Pay now’ button on a Xero online invoice will be mapped to this url:

A number of customer and invoice specific template tags can be passed into this URL so an external application can identify the associated Xero customer and invoice, provided they have previously connected the service with their Xero organisation using the Xero API.

Integration flow

Once payment has been processed, a payment can be applied to the invoice via the API, marking it as paid and completing the process.

The process flow would work something like this:

  1. A Xero customer finds a payment service in the Add-­on directory, or is already a customer of both services.
  2. Within that payment service application, a user connects to their Xero organisation (an API connection). The user should also select any applicable defaults, such as the account in Xero to which invoice payments should be applied.
  3. Once complete, they are given a url to add to invoices sent from Xero. Something like:[INVOICENUMBER]&org=[SHORTCODE]&amount=[AMOUNTDUE] ­ they take this and update their settings in Xero.
  4. When one of their customers is sent an online invoice, they can click on the "Pay now" link and they will be redirected to the url above with the values corresponding to the current invoice
  5. Using the Xero API, the service can check the organisation the invoice belongs to (using the SHORTCODE value) and then retrieve the invoice in question (using the InvoiceNumber & AmountDue values). This will allow the service to populate the amount outstanding, currency etc, and indeed verify that the invoice has not yet been paid.
  6. Once payment has been processed, a payment can be applied via the API, so the invoice is now marked as paid.
  7. The user is redirected back to the online invoice, where they will see the invoice is now marked as paid, confirming completion of the process.