Generate checkout and preview links from Apex

Overview

This feature enables programmatic generation of Limio preview and checkout links for Salesforce Quotes without rendering the Initiate Checkout Flow UI component.

The solution is Flow-ready, asynchronous, and provides a clear distinction between preview and checkout links so they can be routed to the correct Quote fields.

Business Context & Motivation

A typical business use case requires:

  • Preventing manual copying or pasting of checkout URLs

  • Preventing direct navigation to the cart component

  • Ensuring links are only exposed based on explicit business rules

Links must be generated and surfaced automatically when defined conditions are met, for example certain approvals, rather than through user interaction with the UI.

Flow Configuration

Invocable Action

Generate 2 Links for Limio Quote

This invocable action asynchronously generates preview and/or checkout links for a Limio Quote, depending on the target fields provided.

Prerequisites

  • One or two fields on the Limio Quote to store generated links

Field requirements:

  • Field type must be Text or URL

  • Field length must be sufficient to store a full URL

Link generation behavior depends on which target fields are provided:

  • If only the preview target field is provided → only a preview link is generated

  • If only the checkout target field is provided → only a checkout link is generated

  • If both target fields are provided → both preview and checkout links are generated

  • Re-running the action overwrites any existing values in the target fields

Example Flow Setup

  1. Create or edit a Salesforce Flow (record-triggered or autolaunched)

  2. Add the Generate 2 Links for Limio Quote action

  3. Provide values for the input properties lised below

  4. Save and activate the Flow

quoteId

Quote record ID

domain

htps://{yourShopDomain}.com

orderType

new

previewTargetFieldApiName

Preview_Link__c from previous step. At least one of the two must be present.

checkoutTargetFieldApiName

Checkout_Link__c from previous step. At least one of the two must be present.

previewPageTag

- tag of the page you want to navigate your user to

checkoutPageTag

- tag of the page you want to navigate your user to

customFieldsJson

JSON string which will be added to the order payload under order.customFields

customTrackingJson

JSON string which will extend order.tracking object

expiresAfter

specifies expiration time of the link in format 'days/hours/minutes' ( ie '2/2/0' for 2 days and 2 hours, or '0/0/0' for expired). Can be assinged based on a parent Opportunity Close Date.

circle-info

The format for customFieldsJson is detailed in the following article: Custom Fields

Execution Result

The invocable action returns a result object indicating whether the request was successfully submitted for processing:

circle-info

A successful response indicates that link generation was initiated. Actual link creation and field population occur asynchronously.

Error Handling & Troubleshooting

Failure Behavior

If link generation fails, target fields remain unchanged and error details are logged in ExceptionStorage__c. Verify field configuration, Flow execution, and review logs for details.

Troubleshooting Checklist

  1. Verify the target field API names are correct

  2. Ensure target fields:

    • Are of type Text or URL

    • Are long enough to store full URLs

  3. Review ExceptionStorage__c for error details

  4. Confirm the Flow was triggered as expected

Last updated

Was this helpful?