Skip to main content

Package Setup

Firstly, it is necessary to install the Xero package into the client's org - contact the Seven20 Product team to obtain the link for the latest package version. Seven20's Xero package is dependent on the following core product packages:

  • Seven20 - Utilities
  • Seven20 - Core
  • Seven20 - Billing

Connect a Xero developer app

Create the Xero app

  • Navigate to the Xero Developer site and sign in

  • Create a new App and complete the fields on the page

    • For Integration type, select Web app
    • For Redirect URL enter a placeholder value, this will be completed correctly in a later step
  • Enter the newly created app and navigate to Configuration

    tip

    Keep the Xero Configuration tab open in your browser as you will need to refer back to it in future steps.

Set up the Auth. Provider in Salesforce

  • In Salesforce setup navigate to Auth. Providers and create a new record with the values below:
Auth. Provider FieldValue
NameXero
URL SuffixXero
Consumer KeyReturn to the Xero configuration tab, copy the Client id and paste the value in this field
Consumer SecretReturn to the Xero configuration tab, click Generate a secret, copy the value and paste it in this field
Authorize Endpoint URLhttps://login.xero.com/identity/connect/authorize
Token Endpoint URLhttps://login.xero.com/identity/connect/token
Default Scopesopenid profile email offline_access accounting.transactions accounting.contacts
Send access token in headerChecked
Include Consumer Secret in SOAP API ResponsesChecked

Update the Redirect URIs in Xero

  • Under Salesforce Configuration for the newly created record find and copy the Callback URL
  • Return to the Xero configuration tab and overwrite the value in Redirect URIs
  • Save the changes

Set up the credentials in Salesforce

  • With the Auth. Provider created, an OAuth 2.0 external credential must now be created - follow the Salesforce guidance here using the configuration specified below:
External Credential FieldValue
LabelXero
NameXero
Authentication ProtocolOAuth2.0
Authentication Flow TypeBrowser Flow
Authentication ProviderSelect the Auth. Provider created above, Xero
  • Configure and authenticate a Principle with the below configuration
Principal FieldValue
Parameter NameXero
Sequence Number1
Identity TypeNamed Principle
  • The authentication process will launch a browser flow where the User must sign into Xero and select the organisations the integration can access

    info

    If there are multiple Xero Organisations the authentication will have to be repeated as only one Organisation can be authenticated at a time

    info

    Ensure the Principal has been authenticated following the steps in Salesforce documentation

  • Follow the Salesforce guidance to create a named credential with the below configuration:

Principal FieldValue
LabelXero
NameXero
URLhttps://api.xero.com/
Enabled for CalloutsEnabled
External CredentialSelect the External Credential create above, Xero
Generate Authorization HeaderChecked
Allowed Namespacesseven20

Create a Permission Set for External Credentials

Create a new permission set called Xero_External_Credentials

  • Enable access to the external credential principle
    • On the permission set, select the settings for External Credential Principal Access
    • Enable the Principals created above
  • Assign Read permissions for the User External Credentials Object
    • On the permission set, select the Object Settings
    • Navigate to User External Credentials
    • Enable Read permissions
  • Assign this Permission Set to all users who will be using the integration

Set up the webhook

Create a site in Salesforce

Permission TypeNameValue
Apex Classseven20.XeroUpdateInvoiceWebhookEnabled
Custom Metadata Typesseven20.Trigger ActionEnabled

Configure and confirm the webhook in Xero

  • Return to the Xero developer app and navigate to Webhooks
  • In the Notify this app about changes to setting select Invoices
  • In Delivery URL paste the Salesforce site's URL appended with /services/apexrest/seven20/updateInvoiceStatus
  • Save the changes
  • Copy the Webhooks Key
  • In Salesforce setup navigate to Custom Metadata Types and select Xero Connection
  • Navigate to the TenantId metadata record
  • Paste the copied key into the Xero Webhook Key field and save the record
  • Navigate back to the Xero Webhook configuration screen and press Send 'Intent to receive'
  • After a few seconds, the status should appear as OK

Set up Xero Organisations

  • As a Salesforce Admin assign yourself the Xero Admin permission set
  • In the app explorer navigate to Get Organisations
  • Click the Get Organisations button
  • After a few seconds a table of authorised organisations will appear
  • In the object manager for seven20__Billing__c update the seven20__Xero_Organisation__c picklist to match the values displayed in the Get Organisations screen

Setting up multiple currencies

If multiple currencies will be used when sending invoices, they must be enabled in Xero.

danger

Sending a currency from Seven20 that has not been configured in Xero will cause a failure