Loading
Salesforce now sends email only from verified domains. Read More
Automate Your Business Processes
Table of Contents
Select Filters

          No results
          No results
          Here are some search tips

          Check the spelling of your keywords.
          Use more general search terms.
          Select fewer filters to broaden your search.

          Search all of Salesforce Help
          Ensure Funds Async Action

          Ensure Funds Async Action

          Ensure funds for an invoice, and apply them to the invoice. Optionally, apply the funds in a defined sequence. If needed, capture authorized funds by sending a request to a payment provider. This action inserts a background operation into an asynchronous job queue and returns the ID of that operation so you can track its status. Payment gateway responses appear in the payment gateway log and don’t affect the background operation status.

          Required Editions

          Available in: Lightning Experience
          View supported editions.
          This feature requires the Salesforce Order Management add-on. To purchase, contact your Salesforce account executive.
          Note
          Note Payment sequencing for ensuring funds is available in sandbox orgs. It’s available in production on a rolling basis in Spring ’26. Contact Salesforce Customer Support for more information.

          In Flow Builder, add an Action element to your flow. Select the Order Management category, and search for Ensure Funds Async.

          (Optional) To sequence payments, in Flow Builder, add an Action element to your flow. Select the Order Management category, and search for Ensure Funds with Sequence OrderPaymentSummaries.

          Note
          Note If the action creates a payment, the payment record’s ClientContext value isn’t predictable. Don't use it in custom logic.

          Set Input Values

          Use values from earlier in the flow to set the inputs.

          Input Parameter Description
          Ensure Funds Async Input

          This input is an Apex-defined variable of class ConnectApi.EnsureFundsAsyncInputRepresentation.

          The variable has these fields: invoiceId- The ID of the invoice to ensure funds for and apply them to.

          isConsiderReservedBalanceAmount- If true, the reserved balance amount is used for the order summary to fund the invoice. If there’s not enough reserved balance amount, any available balance that isn’t reserved by another summary is used. If false, any available balance is used.

          isAllowPartial- If true, partial funding of the invoice is allowed. Optionally, you can define a sequence in which to capture payments for the invoice. If you don’t define a sequence for this value, or this value is false, then the default capture logic is applied.

          sequences- This value is an ordered list of amounts and the OrderPaymentSummaries to apply them to. It’s a list of Apex-defined variables of class SequenceOrderPaymentSummaryInputRepresentation. It contains these fields:

          • amount-Amount to apply to the OrderPaymentSummary.
          • orderPaymentSummaryId- ID of the OrderPaymentSummary to apply the amount to.
          Order Summary Id Reference to the order summary associated with the invoice.

          Store Output Values

          Output Parameter Description
          Ensure Funds Async Output

          This value is an Apex-defined variable of class EnsureFundsAsyncOutputRepresentation. It only returns the ID of the asynchronous background operation, regardless of whether a call is made to an external payment gateway. It doesn’t include any errors from the operation.

          The backgroundOperationId field contains the ID of the background operation.

          Usage

          This action applies funds to the invoice balance from order payment summaries associated with the specified order summary following this logic:

          Note
          Note If multiple order payment summaries have equal BalanceAmount values, their order of selection is random.
          • Verify that the invoice balance doesn’t exceed the total BalanceAmount of all the order payment summaries associated with the order summary.
          • If an order payment summary has a BalanceAmount equal to the invoice balance, apply the funds from that order payment summary.
          • If no exact match was found, apply funds from the order payment summary with the largest BalanceAmount.
          • If the invoice still has a balance to ensure, repeat steps 2 and 3 until the full balance is ensured or no captured funds remain.
          • If the invoice still has a balance, look for an order payment summary with an authorized amount equal to the remaining invoice balance. If one exists, capture and apply the funds from that order payment summary.
          • If no exact match was found, capture and apply funds from the order payment summary with the largest authorized amount.
          • If the invoice still has a balance to ensure, repeat steps 5 and 6 until the full balance is ensured.
           
          Loading
          Salesforce Help | Article