Salesforce CRM
Lago syncs billing data to Salesforce in real-time.
PREMIUM ADD-ON ✨
This integration is only available to users with a specific paying add-on. Please contact us to get access to Salesforce CRM integration.
Object mapping
Lago to Salesforce object mapping
I. Integration configuration
Install Salesforce CRM Package
To gain premium access to our Salesforce Package application, please don’t hesitate to contact us. You can initiate the installation process by clicking on the provided link, which will direct you to the installation page where you can follow step-by-step instructions for a seamless integration. If you have any questions or need assistance during the installation, our dedicated support team is here to help you every step of the way.
Install Lago Salesforce App package
To ensure a successful installation, please follow these steps:
- We recommend selecting the “Install for all users” option;
- Click on the “Install” button;
- Make sure to check the box to grant access to these third-party websites; and
- Once completed, you’ll have successfully installed the Lago Salesforce App.
Please note that the installation process may take a few minutes to complete. However, rest assured that you will receive an email confirmation once the installation is finished.
Webhook config: sync real-time data
After installation in Salesforce CRM, set up a webhook URL in Salesforce to receive real-time data from Lago. This involves configuring a new “Site” in Salesforce’s setup section. Note that the four main actions described below should be performed by a Salesforce Admin and is only required during the initial setup.
Access the Site section in Salesforce
- Click the gear icon in the upper right to access Salesforce Setup;
- Search and navigate to the Sites section; and
- Create a new Site (see picture below).
Create a new Site in Salesforce
Create a new Site in Salesforce
When creating a new site, follow these steps:
- Set a unique Site Label;
- Specify a unique Site Name;
- Optionally, add a Site Description;
- Ensure the Site Contact and Default Record Owner are filled;
- Set the Default Web Address prefix to
getPushNotification
; - Choose
SiteLogin
as the Active Site Home Page; and - Don’t forget to save the new site: and
- Activate the newly created site by going to the Site Details and clicking the
Activate
button.
New site creation flow in Salesforce
Edit Public Access Settings in Salesforce
To edit Public Access Settings for your new Site:
- Visit the site and click Public Access Settings;
- In the Enabled Apex Class Access section, click “edit”;
- Add
LagoWebHookSubscriptionController
to Enabled Apex Classes; and - Save your changes.
Edit Salesforce's site Public Access Settings
Paste the Webhook URL into Your Lago App
To set up the webhook URL for real-time data syncing between Lago and Salesforce, follow these steps:
- Return to your newly created site;
- Locate the Custom URLs section;
- Copy the domain name (e.g., lago.my.salesforce-sites.com);
- Add the
https://
prefix to this domain name (e.g.,https://lago.my.salesforce-sites.com
); and - Append
/services/apexrest/lago/api/Webhooks/incoming/pushDetails/
to the domain name (e.g.,https://lago.my.salesforce-sites.com/services/apexrest/lago/api/Webhooks/incoming/pushDetails/
).
Find Salesforce's site domain name
Now, go to your Lago app and past this webhook into the webhook’s settings:
- Within Lago, navigate to Developers;
- Visit the Webhooks tab;
- Choose
HMAC
as the mandatory signature type; - Paste your Salesforce webhook URL; and
- Save this webhook endpoint.
Congratulations! You’re ready to sync real-time data from Lago to Salesforce! 🎉
Paste Salesforce webhook URL to Lago
Establish and finalize connection
Connect your Lago instance to Salesforce Lago App
Option 1: Configure a standard API Base URL To establish a connection between your Lago instance and the Salesforce Package, follow these steps:
- Access Salesforce and locate the App Launcher;
- Find and open the Lago app you recently installed;
- Within the Lago Base Configuration tab:
- Provide your Lago API Key (located in Lago’s Developer Section)
- Enter your Lago API base URL. Do not insert the
api/v1
at the end of the URL. By default, the valid URL ishttps://api.getlago.com/
. If you want to change the API base URL to another one (e.g.,https://api.eu.getlago.com/
or a custom self-hosted one), please follow option 2. - Enter lago app URL (Front End Base URL). By default, the valid URL is
https://app.getlago.com/
(it will be different for self-hosted).
- “Save and validate” your connection; and
- If the Lago API Key is valid then only Start Data Sync button will be enabled.
- Click the “Start Data Sync” to finalize the connection between Lago and Salesforce.
Please note that data synchronization is available only for Lago customers with an external_salesforce_id
and an existing Salesforce Account.
Option 2: Configure a custom API Base URL If you use your own Lago API base URL (self-hosting) or one for a different server instance, you can customize it directly in Salesforce:
- Navigate to Salesforce’s Setup;
- Search for and select Remote Site Settings;
- Find and access the remote site for the Lago App;
- Click the Edit button to modify the remote site’s details;
- Update the Remote Site URL with your preferred URL; and
- Save the changes.
II. Sync data from Lago to Salesforce
If your webhook endpoint is configured correctly, your billing data will flow seamlessly in real-time.
Please note that Subscriptions and Invoices will be created in Salesforce via webhooks seamlessly
Sync customers to Salesforce
To synchronize Lago Customer data with Salesforce Accounts (native object), ensure that your
Salesforce Account is created first, and that the Lago Customer’s external_salesforce_id
is explicitly populated.
- Begin by creating a new Account in Salesforce or accessing an existing one;
- Next, create a customer in Lago and populate the
external_salesforce_id
field for a Lago Customer with the Salesforce Account Id; and - Finally, your Salesforce Account and Lago Customer are synchronized!
Billing data will not sync unless these requirements are met.
Lago does not create Salesforce Accounts.
Before syncing billing data, you need to create or retrieve an existing Account in Salesforce
and populate the Lago customer field called external_salesforce_id
.
Salesforce Account with Lago Customer information
Sync subscriptions to Salesforce
Sync subscriptions data from Lago to Salesforce
Whenever a subscription is created for a Lago Customer, the subscription details will be automatically
synced in real-time with Salesforce using the Lago Subscriptions
custom object.
Here is a list of Subscription fields that are automatically synced. Note that this subcription is automatically linked to a Salesforce Account:
- Subscription Id;
- Subscription Name;
- Subscription Start Date;
- Subscription Status;
- Subscription Termination Date (synced when the subscription is terminated);
- Subscription Billing Time (either
calendar
oranniversary
); and - Plan Code.
Sync invoices to Salesforce
Sync invoices data from Lago to Salesforce
Whenever an invoice is issued for a Lago Customer, the invoice details will be automatically
synced in real-time with Salesforce using the Lago Invoices
custom object.
Here is a list of Subscription fields that are automatically synced:
- Invoices Number;
- Invoice Payment Status;
- Invoice Type (
subscription
orone-off
); - Invoice Issuing Date;
- Invoice Amount;
- Invoice File Url; and
- Invoice Currency.
Sync credit notes to Salesforce
Whenever a credit note is issued for a Lago Invoice, the credit note details will be automatically
synced in real-time with Salesforce using the Lago CreditNotes
custom object.
Sync Plans, Add-Ons to Salesforce
Plans and Add-ons are synced to Salesforce when we initially click on Start Data Sync from Lago Base Configuration page.
- Plans are synced to
Lago Plans
object andProduct2
standard object. We also create a price book entry for all the products inStandard Price Book
price book - Add-Ons are synced to
Lago Add-Ons
object andProduct2
standard object. We also create a price book entry for all the products inStandard Price Book
price book.
Schedule Sync from Lago To Salesforce
We also provide option to schedule the data sync from Lago to Salesforce.
LagoSyncScheduleable
— a schedulable class which helps us schedule either all the data or any one of them.- To schedule the sync of any ONE of the object:
- Create a new instance of class by passing any one of the following string:
CUSTOMER
,SUBSCRIPTION
,PLAN
,ADDON
,INVOICE
,CREDITNOTE
- Ex: To sync Plans from lago to Salesforce everyday at 1PM, execute below anonymous code in Anonymous window in Developer Console. (click here to learn more about CRON expression)
//Create a new instance. Pass 'PLAN' in brackets. lago.LagoSyncScheduleable syncPlan = new lago.LagoSyncScheduleable('PLAN'); //CRON expression to schedule a job everyday at 1 PM String schedule_cron = '0 0 13 * * ?'; //schedule(name, cron_expression, class_instance) System.schedule('Sync Lago Plan', schedule_cron, syncPlan);
- Ex: To sync Plans from lago to Salesforce everyday at 1PM, execute below anonymous code in Anonymous window in Developer Console. (click here to learn more about CRON expression)
- Create a new instance of class by passing any one of the following string:
- To schedule the sync of ALL the objects:
- create a new instance of class by passing
true
- Ex: To sync all objects from lago to Salesforce everyday at 1PM, execute below anonymous code in Anonymous window in Developer Console. (click here to learn more about CRON expression)
//Create a new instance. Pass true in brackets. lago.LagoSyncScheduleable syncAll = new lago.LagoSyncScheduleable(true); //CRON expression to schedule a job everyday at 1 PM String schedule_cron = '0 0 13 * * ?'; //schedule(name, cron_expression, class_instance) System.schedule('Sync Lago all', schedule_cron, syncAll);
- Ex: To sync all objects from lago to Salesforce everyday at 1PM, execute below anonymous code in Anonymous window in Developer Console. (click here to learn more about CRON expression)
- create a new instance of class by passing
III. Actions from Salesforce to Lago
Beyond just syncing data from Lago to Salesforce, you can also initiate actions in Lago directly from Salesforce.
You can leverage Salesforce Flows
to execute actions in Lago. Lago provides several customizable templates for creating customers from Salesforce Accounts, directly assigning subscriptions to customers from Salesforce, creating one-off invoice from salesforce.
Create customers
Flow: Lago Template - Create Customer in Lago on Account Create
Use Lago template to create a customer on Account creation
To create a customer in Lago upon the creation of a Salesforce Account, utilize the Flow template provided by Lago.
- Log into your Salesforce instance;
- Access the Setup section via the settings wheel icon in Salesforce;
- Find and select
Flows
under Process Automation in the sidebar; - Locate and open the
Lago Template - Create Customer in Lago on Account Create
; - Click ‘Save As’ to create and save your own version of the template; and
- Do not forget to click the
Activate
button to activate your flow.
You have the flexibility to modify various aspects of this flow, including the trigger conditions and field mappings. By default, the action is initiated when a Lago ID is absent. Additionally, you can customize how fields are mapped from your Salesforce instance to Lago.
Customize the flow
Create subscriptions (automation)
Assigning a plan to a customer, adjusting negotiated prices, and initiating the subscription upon winning an opportunity represents a key action from Salesforce to Lago. This enables sales teams to remain within Salesforce, their primary tool, and activate billing processes directly, without the need to switch platforms.
To assign a subscription and set prices in Lago directly from Salesforce, use the provided two flows via following Lago Flow templates.
Flow 1: Lago Template - Create Lago SObject Records
This Flow is used to create intermediate records in Lago Objects - Lago Subscription
- Log into your Salesforce instance;
- Access the Setup section via the settings gear icon in Salesforce;
- Find and select
Flows
under Process Automation in the sidebar; - Locate and open the
Lago Template - Create Lago SObject Records
; - Click ‘Save As’ to create and save your own version of the template; and
- Do not forget to click the
Activate
button to activate your flow.
Validate the flow
The default setting triggers plan assignment when a Salesforce Account links to a Lago customer and the opportunity status changes to closed-won. You can customize this flow to suit your specific needs. Moreover, you have the option to adjust the subscription fields and subscription charges fields being synchronized from Salesforce to Lago.
Customize the flow
Assign subscription and override prices
- Create an opportunity by assigning an expected closed date and a stage;
- Add a Lago plan to this opportunity as a product (Salesforce will automatically retrieve all plans from Lago in
Standard Price Book
); - Specify
1
for the quantity of the plan; - Use the custom UI to either assign this plan directly or to override prices; and
- Click on ‘Lago Override Plan’ to finalize the subscription assignment.
By default, the lago subscription record in salesforce is created when the opportunity is closed-won
. You can assign multiple subscriptions for the same opportunity.
Flow 2: Lago Template - Create Subscription in Lago on Subscription Creation/Update
This Flow is used to create subscriptions in Lago from Salesforce
- Log into your Salesforce instance;
- Access the Setup section via the settings gear icon in Salesforce;
- Find and select
Flows
under Process Automation in the sidebar; - Locate and open the
Lago Template - Create Subscription in Lago on Subscription Creation/Update
; - Click ‘Save As’ to create and save your own version of the template; and
- Do not forget to click the
Activate
button to activate your flow.
The default setting triggers plan assignment when SyncToLago
checkbox is checked. You can customize this flow to suit your specific needs.
Create subscriptions (lago native UI)
We also have option to create subscriptions in Lago directly from Salesforce using Lago’s create subscription screen.
- Log into your Salesforce instance;
- Access the setup section via the settings gear icon in Salesforce;
- Go to Object manager and find and open account object;
- Go to page layout (or Lightning record page) depending on what you are using, and open the page layout in which you’d like to add the button to create subscription.
- Add the button
Lago Subscription
- Save the page layout or lightning record page.
Open any account which has lago_id
populated. Click on Lago Subscription
button; it will pop-up Lago Screen (make sure you’ve entered correct Front End URL
in Lago Base Configuration page); enter correct username and password. Save. A new subscription will be directly created in Lago. And, if Webhooks are configured correctly, it will also create Lago Subscription
record in Salesforce.
Lago Subscription from SF (iframe)
We can add a new button Lago Subscription on Account page or Opportunity page A new Lago Subscription record will be created via webhooks (if configured). And after 1 minute another callout will be made to sync Charges.
Terminate Subscription
We can terminate the subscription from Salesforce to lago only if the subscription is already synced to lago(status is active or pending).
Go to Lago Subscription record in Salesforce, and check Terminate Subscription
checkbox.
As soon as Terminate Subscription
is checked it will terminate the subscription in Lago. It is handled from the backend via trigger.
Create one-off invoice
This enables sales team to create one-off invoice in lago from Salesforce.
Right from the opportunity record we add products which are related to Lago Add-ons
, specify the quantity, description and amount.
To create one-off invoice and set prices in Lago directly from Salesforce, use the provided two flows via following Lago Flow templates.
Flow 1: Lago Template - Create Lago SObject Records
The same flow as we created above to create subscription - is also used to create intermediate records in Lago Objects - Lago Invoice
Flow 2: Lago Template - Generate Invoice in Lago On Lago Invoice Field Update
This Flow is used to create one-off invoice in Lago from Salesforce
- Log into your Salesforce instance;
- Access the Setup section via the settings gear icon in Salesforce;
- Find and select
Flows
under Process Automation in the sidebar; - Locate and open the
Lago Template - Generate Invoice in Lago On Lago Invoice Field Update
; - Click ‘Save As’ to create and save your own version of the template; and
- Do not forget to click the
Activate
button to activate your flow.
The default setting triggers create invoice when SyncToLago
checkbox is checked. You can customize this flow to suit your specific needs.
Create one-off invoice (lago native UI)
We also have option to create one off invoice in Lago directly from Salesforce using Lago’s create invoice screen.
- Log into your Salesforce instance;
- Access the setup section via the settings gear icon in Salesforce;
- Go to Object manager and find and open Account object or Opportunity;
- Go to page layout (or Lightning record page) depending on what you are using, and open the page layout in which you’d like to add the button to create Invoice.
- Add the button
Lago Invoice
- Save the page layout or lightning record page.
Open any account which has lago_id
populated. Click on Lago Invoice
button; it will pop-up Lago Screen (make sure you’ve entered correct Front End URL
in Lago Base Configuration page); enter correct username and password. Save. A new Invoice will be directly created in Lago. And, if Webhooks are configured correctly, it will also create Lago Invoice
record in Salesforce.
Lago Invoice from SF (iframe)
We can add a new button Lago Invoice on Account page or Opportunity page A new Lago Invoice record will be created via webhooks (if configured). After 1 minute another callout will be made to sync invoice line items (add ons).
Get Invoice pdf
Now we can also get invoice pdf directly directly from Salesforce.
- Go to Lago Invoice
- Open any Invoice which is already synced.
- Click
Get Invoice pdf
> it will open PDF in a new tab.
Debugging & logs
To ensure seamless data synchronization between Lago and Salesforce, every action and data transfer is meticulously logged. These logs are accessible directly through the Lago package for comprehensive debugging and analysis:
- Navigate to ‘Lago Base Configuration’: This is your starting point for accessing the debugging tools. and
- Access Logs: Click on the ‘Logs’ tab to view a detailed record of all activities.
You can refresh logs to keep your data current or delete unnecessary logs to maintain clarity and efficiency in the debugging process. This approach aids in promptly identifying and resolving integration issues.
Was this page helpful?