Skip to main content
PREMIUM ADD-ON ✨This integration is only available to users with a specific paying add-on. Please contact us to get access to the Salesforce CRM integration.

Object mapping

Diagram mapping Lago objects to Salesforce standard and custom objects

Lago to Salesforce object mapping

I. Integration configuration

Create integration for Salesforce on Lago side

Contact us to get premium access to the Lago Salesforce package. Log in to Lago as an admin user, navigate to Settings > Integrations > Salesforce (allowed only if the team has enabled it for your account), and click “Create new”. Enter the following details:
  • Name
  • Code
  • Salesforce Instance (URL of your Salesforce instance)
Lago form to create a Salesforce integration with a name, a code and the Salesforce instance URL

Create new Salesforce integration in Lago

Note the integration code shown in the connection details, you need it later:
Lago connection details screen showing the Salesforce integration code

Salesforce integration connection details

Install Salesforce CRM package

Click the link we provide to open the installation page, then follow the instructions. Contact us if you need help during the installation.
Salesforce package installation screen for the Lago CRM package

Install Lago Salesforce App package

Follow these steps:
  1. We recommend selecting the “Install for all users” option;
  2. Click on the “Install” button;
  3. Make sure to check the box to grant access to these third-party websites; and
  4. Once completed, you’ll have successfully installed the Lago Salesforce App.
The installation can take a few minutes. You receive an email confirmation once it 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 must be performed by a Salesforce admin, and are only required during the initial setup.
1

Access the Site section in Salesforce

  1. Click the gear icon in the upper right to access Salesforce Setup;
  2. Search and navigate to the Sites section; and
  3. Create a new Site (see picture below).
Salesforce Setup with the Sites section open and the button to create a new Site

Create a new Site in Salesforce

2

Create a new Site in Salesforce

When creating a new site, follow these steps:
  1. Set a unique Site Label;
  2. Specify a unique Site Name;
  3. Optionally, add a Site Description;
  4. Ensure the Site Contact and Default Record Owner are filled;
  5. Set the Default Web Address prefix to getPushNotification;
  6. Choose SiteLogin as the Active Site Home Page; and
  7. Don’t forget to save the new site; and
  8. Activate the newly created site by going to the Site Details and clicking the Activate button.
Salesforce new Site form with the site label, name and default web address prefix

New site creation flow in Salesforce

3

Edit Public Access Settings in Salesforce

To edit Public Access Settings for your new Site:
  1. Visit the site and click Public Access Settings;
  2. In the Enabled Apex Class Access section, click “edit”;
  3. Add LagoWebHookSubscriptionController to Enabled Apex Classes; and
  4. Save your changes.
Salesforce Public Access Settings with the Enabled Apex Class Access section

Edit Salesforce's site Public Access Settings

4

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:
  1. Return to your newly created site;
  2. Locate the Custom URLs section;
  3. Copy the domain name (e.g., lago.my.salesforce-sites.com);
  4. Add the https:// prefix to this domain name (e.g., https://lago.my.salesforce-sites.com); and
  5. 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/).
Salesforce site details showing the Custom URLs section with the domain name

Find Salesforce's site domain name

Now, go to your Lago app and paste this webhook into the webhook settings:
  1. Within Lago, navigate to Developers;
  2. Visit the Webhooks tab;
  3. Choose HMAC as the mandatory signature type;
  4. Paste your Salesforce webhook URL; and
  5. Save this webhook endpoint.
You are now ready to sync real-time data from Lago to Salesforce.
Adding the Salesforce webhook URL in the Lago webhook settings

Paste Salesforce webhook URL to Lago

Establish and finalize connection

Entering the Lago API key, API base URL and integration code in the Lago Base Configuration tab in Salesforce

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:
  1. Access Salesforce and locate the App Launcher;
  2. Find and open the Lago app you recently installed;
  3. 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 is https://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).
  • Enter Lago Integration code from Step 1 Salesforce integration on Lago
  1. “Save and validate” your connection; and
  • If the Lago API Key is valid then only Start Data Sync button will be enabled.
  1. 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:
  1. Navigate to Salesforce’s Setup;
  2. Search for and select Remote Site Settings;
  3. Find and access the remote site for the Lago App;
  4. Click the Edit button to modify the remote site’s details;
  5. Update the Remote Site URL with your preferred URL; and
  6. Save the changes.

II. Sync data from Lago to Salesforce

If your webhook endpoint is configured correctly, your customer, subscription, and billing data flow in real time.
From Salesforce for Lago v2.7 onwards, customers, subscriptions and invoices are created in Salesforce through webhooks.

Sync customers to Salesforce (> v2.7)

If you already have Lago customers to synchronize with Salesforce, contact our team to start the migration.
To establish a new customer connection between Lago and Salesforce, follow these steps:
  1. Navigate to the customer creation screen in Lago
  2. Complete the standard customer information fields
  3. Expand the ‘Connect to external apps’ section at the bottom of the form
  4. Select Salesforce and choose the integration established during the initial setup
  5. Choose the appropriate synchronization method:
  • For new Salesforce customers: Enable the Create automatically this customer option
  • For existing Salesforce customers: Enter the corresponding ‘Salesforce Account ID’
Lago customer form with the Connect to external apps section and the Salesforce integration selected

Customer external apps connection interface

The system handles account creation in Salesforce based on your configuration:For Salesforce instances with Person Accounts enabled:When Customer Type is set to Individual: Creates a Person Record type account.When Customer Type is Company or unspecified: Creates a standard company account using the default record type for the running userFor Salesforce instances without Person Accounts: Creates all accounts using the default record type associated with the running user
Important considerations for customer record management:Synchronized customer records have specific update restrictions in Salesforce to maintain data integrityWhen using the Lago Integration Code (available for >= v2.7):The system sets sync_with_provider to true. This setting allows future updates from Lago in Salesforce.Without the Lago Integration Code (for < v2.7):We don’t keep the data in sync from Lago to Salesforce. Only the initial sync is available from Lago to Salesforce, see the section below.

Sync customers to Salesforce (< v2.7)

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.
  1. Begin by creating a new Account in Salesforce or accessing an existing one;
  2. Next, create a customer in Lago and populate the external_salesforce_id field for a Lago Customer with the Salesforce Account Id; and
  3. Your Salesforce Account and Lago Customer are now 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 showing the synced Lago customer information

Salesforce Account with Lago Customer information

Sync subscriptions to Salesforce

Lago subscription appearing in the Lago Subscriptions custom object in 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 subscription 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 or anniversary); and
  • Plan Code.

Sync invoices to Salesforce

Lago invoice appearing in the Lago Invoices custom object in 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 invoice fields that are automatically synced:
  • Invoice Number;
  • Invoice Payment Status;
  • Invoice Type (subscription or one-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 and 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 and Product2 standard object. We also create a price book entry for all the products in Standard Price Book price book
  • Add-Ons are synced to Lago Add-Ons object and Product2 standard object. We also create a price book entry for all the products in Standard Price Book price book.

Sync coupons and applied coupons to Salesforce

Coupons and Applied coupons are synced to Salesforce when we click on Start Data Sync from Lago Base Configuration page.
  • Coupons are synced to Lago Coupons custom object. All the existing coupons will be available in Salesforce. Please note: we cannot create coupons from Salesforce to Lago, we must create coupons in Lago.
  • Applied coupons are synced to Lago Applied Coupon custom object.

Schedule sync from Lago to Salesforce

We also provide an 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)
  • 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)

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, assigning subscriptions to customers from Salesforce, and creating one-off invoices from Salesforce.

Create customers

Flow: Lago Template - Create Customer in Lago on Account Create

Salesforce Flows list with the Lago template to create a customer on Account creation

Use Lago template to create a customer on Account creation

To create a customer in Lago when a Salesforce Account is created, use the Flow template provided by Lago.
  1. Log into your Salesforce instance;
  2. Access the Setup section via the settings wheel icon in Salesforce;
  3. Find and select Flows under Process Automation in the sidebar;
  4. Locate and open the Lago Template - Create Customer in Lago on Account Create;
  5. Click ‘Save As’ to create and save your own version of the template; and
  6. Do not forget to click the Activate button to activate your flow.
You can modify this flow, including the trigger conditions and the field mappings. By default, the action starts when a Lago ID is absent. You can also customize how fields are mapped from your Salesforce instance to Lago. You can also set the customer type to ‘Individual’ or ‘Company’ when you create a customer from Salesforce in Lago.
Editing the Salesforce Flow that creates a Lago customer from an Account

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. Sales teams stay in Salesforce, their primary tool, and start billing directly, without switching platforms. To assign a subscription and set prices in Lago directly from Salesforce, use the two Lago Flow templates below.

Flow 1: Lago Template - Create Lago SObject Records

This Flow is used to create intermediate records in Lago Objects - Lago Subscription
  1. Log into your Salesforce instance;
  2. Access the Setup section via the settings gear icon in Salesforce;
  3. Find and select Flows under Process Automation in the sidebar;
  4. Locate and open the Lago Template - Create Lago SObject Records;
  5. Click ‘Save As’ to create and save your own version of the template; and
  6. Do not forget to click the Activate button to activate your flow.
1

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.
Editing the Salesforce Flow that creates Lago subscription records

Customize the flow

2

Assign subscription and override prices

  1. Create an opportunity by assigning an expected closed date and a stage;
  2. Add a Lago plan to this opportunity as a product (Salesforce will automatically retrieve all plans from Lago in Standard Price Book);
  3. Specify 1 for the quantity of the plan;
  4. Use the custom UI to either assign this plan directly or to override prices; and
  5. 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
  1. Log into your Salesforce instance;
  2. Access the Setup section via the settings gear icon in Salesforce;
  3. Find and select Flows under Process Automation in the sidebar;
  4. Locate and open the Lago Template - Create Subscription in Lago on Subscription Creation/Update;
  5. Click ‘Save As’ to create and save your own version of the template; and
  6. 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 an option to create subscriptions in Lago directly from Salesforce, using Lago’s create subscription screen.
  1. Log into your Salesforce instance;
  2. Access the setup section via the settings gear icon in Salesforce;
  3. Go to Object manager and find and open account object;
  4. 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.
  5. Add the button Lago Subscription
  6. Save the page layout or lightning record page.
Open any account which has lago_id populated. Click the Lago Subscription button. A Lago screen opens (make sure you entered the correct Front End URL on the Lago Base Configuration page). Enter your username and password, then save. The subscription is created directly in Lago. And, if Webhooks are configured correctly, it will also create Lago Subscription record in Salesforce.
Lago subscription creation screen opened in an iframe from a Salesforce Account

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 in Lago only if the subscription is already synced to Lago (status is active or pending). Go to the Lago Subscription record in Salesforce, and check the 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 teams to create a 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 a one-off invoice and set prices in Lago directly from Salesforce, use the two Lago Flow templates below.

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
  1. Log into your Salesforce instance;
  2. Access the Setup section via the settings gear icon in Salesforce;
  3. Find and select Flows under Process Automation in the sidebar;
  4. Locate and open the Lago Template - Generate Invoice in Lago On Lago Invoice Field Update;
  5. Click ‘Save As’ to create and save your own version of the template; and
  6. 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 an option to create a one-off invoice in Lago directly from Salesforce, using Lago’s create invoice screen.
  1. Log into your Salesforce instance;
  2. Access the setup section via the settings gear icon in Salesforce;
  3. Go to Object manager and find and open Account object or Opportunity;
  4. 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.
  5. Add the button Lago Invoice
  6. Save the page layout or lightning record page.
Open any account which has lago_id populated. Click the Lago Invoice button. A Lago screen opens (make sure you entered the correct Front End URL on the Lago Base Configuration page). Enter your username and password, then save. The invoice is created directly in Lago. And, if Webhooks are configured correctly, it will also create Lago Invoice record in Salesforce.
Lago invoice creation screen opened in an iframe from a Salesforce Account

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

We can also get the invoice PDF directly from Salesforce.
  1. Go to the Lago Invoice tab;
  2. Open an invoice that is already synced; and
  3. Click Get Invoice pdf, the PDF opens in a new tab.

Get invoice line item details

We can fetch Invoice line items manually for any invoices if required.
  1. Go to Lago Invoice tab > Open any Invoice which is already synced.
  2. Click on Lago Sync Invoice Line Item button. If button is not present on the layout, please add it on Page layout or Lightning record page.
  3. All lago items will be synced and available in Lago Line Items child custom object.
Syncing the invoice line items of a Lago Invoice record in Salesforce

Get Invoice line items

Managing coupons in Salesforce

The Salesforce integration allows you to manage customer coupons directly from your Salesforce interface. This section explains how to apply coupons to customer accounts and how to manage existing ones.

Applying coupons to accounts

First, configure your Salesforce environment. The “Apply Coupon” action button must be available in your account page layout or lightning record page. If you don’t see this button, work with your Salesforce administrator to add it through the page layout editor or lightning app builder. Then follow these steps to apply a coupon to a customer account:
  1. Navigate to the account details page for the customer who will receive the coupon.
  2. Click the “Apply Coupon” action button. A popup dialog opens for the coupon configuration.
  3. Select and Configure the Coupon. The configuration options will vary depending on the type of coupon you’re applying:
  • For Fixed Amount Coupons: Enter the discount amount, select the appropriate currency, Choose the frequency for applied coupon
If the Lago customer currency is already set in the account, the currency field will be locked to maintain consistency.
  • For recurring frequencies, specify the duration period
  • For Percentage-Based Coupons: Verify or adjust the percentage rate, set the frequency of application
    • For recurring frequencies, enter the duration period
  1. Complete the Application
  • Click the “Apply Coupon” button to finalize the process.
  • This action will:
    • Create an Applied Coupon record in Salesforce
    • Synchronize the coupon with the customer’s account in Lago
    • Enable the discount for future qualifying transactions
Applying a coupon to a Salesforce Account with the Apply Coupon action button

Apply Coupon on Account

Terminating active coupons

To end a coupon before its expiration date:
  1. Access the Coupon Record. Navigate to the Applied Coupon details page for the coupon you wish to terminate.
  2. Locate the “Terminate Coupon” checkbox in the record.
  3. Confirm Termination: Check the box to initiate the termination process. Upon saving:
  • The coupon status will update from “Active” to “Terminated”
  • The change will synchronize with Lago
  • The customer will no longer receive the discount
Coupon termination is permanent. Once a coupon is terminated, it cannot be reactivated. Apply a new coupon if the discount needs to be reinstated.

Debugging & logs

Every action and data transfer between Lago and Salesforce is logged. The logs are accessible through the Lago package:
  1. Navigate to ‘Lago Base Configuration’, the starting point for the debugging tools; and
  2. Access Logs: Click on the ‘Logs’ tab to view a detailed record of all activities.
You can refresh the logs to keep them current, or delete the ones you no longer need.