---
schema_version: "1"
id: 95ead5a09815a1f720aedcf5caf405ae8040ed9bf5790c040c6c7009efab1086
title: Ensure Funds Async Action
collection: admin
version: current
locale: en-us
portal_url: https://docs.salesforce.com/admin/current/en-us/platform/264-0-0/flow_ref_elements_om_actions_ensure_funds_async.md
canonical_url: https://help.salesforce.com/s/articleView?id=platform.flow_ref_elements_om_actions_ensure_funds_async.htm&release=264.0.0&type=5
source_site: help.salesforce.com
content_type: documentation
content_hash: 99bd5c19f351721efa9ea0906dd39334012ebf0d5acdecd612a11599e12dbf6d
description: 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.
products:
  - Flow Builder
  - Salesforce Platform
release: "264"
---
# 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

<table class="slds-table slds-table_bordered slds-max-medium-table_stacked slds-m-bottom_small edition"><colgroup><col></colgroup><tbody><tr class=""><td class="slds-cell-wrap" style="vertical-align:top;">Available in: Lightning Experience</td></tr><tr class=""><td class="slds-cell-wrap" style="vertical-align:top;"><a href="https://help.salesforce.com/s/articleView?id=platform.flow_ref_supported_editions.htm&amp;release=264.0.0&amp;type=5" title="Learn about the editions and user interfaces that support Flow Builder. Some Flow Builder features integrate with other Salesforce products that require additional licenses.">View supported editions.</a></td></tr><tr class=""><td class="slds-cell-wrap" style="vertical-align:top;">This feature requires the Salesforce Order Management add-on. To purchase, contact your Salesforce account executive.</td></tr></tbody></table>

![Note](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-platform-platform_automation-264-0-0-production-enus/60568438-ec7e-4665-acd1-7c80dcbe60d5/images/icon_note.png)

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](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-platform-platform_automation-264-0-0-production-enus/60568438-ec7e-4665-acd1-7c80dcbe60d5/images/icon_note.png)

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.

<table class="slds-table slds-table_bordered slds-max-medium-table_stacked slds-m-bottom_small ">
        <colgroup>
          <col style="width:17.006802721088434%">
          <col style="width:82.99319727891157%">
        </colgroup>
        <thead class="slds-text-title_caps ">
          <tr class="">
            <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d273197e96">Input Parameter</th>
            <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d273197e99">Description</th>
          </tr>
        </thead>
        <tbody>
          <tr class="">
            <td data-label="Input Parameter" class="slds-cell-wrap" style="vertical-align:top;" headers="d273197e96 ">
              <strong class="uicontrol">Ensure Funds Async Input</strong>
            </td>

            <td data-label="Description" class="slds-cell-wrap" style="vertical-align:top;" headers="d273197e99 ">
              <p>This input is an Apex-defined variable of class <a href="https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_connectapi_input_ensure_funds_async.htm" target="_blank">ConnectApi.EnsureFundsAsyncInputRepresentation</a>.</p>
              <p>The variable has these
                fields: <var>invoiceId</var>- The ID of the invoice to ensure funds for
                and apply them to.</p>
              <p><var>isConsiderReservedBalanceAmount</var>- 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.</p>
              <p><var>isAllowPartial</var>- 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.</p>
              <p><var>sequences</var>- 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:</p>
              <ul>
                <li><var>amount</var>-Amount to apply to the OrderPaymentSummary.</li>

                <li><var>orderPaymentSummaryId</var>- ID of the OrderPaymentSummary to
                  apply the amount to.</li>

              </ul>
            </td>

          </tr>
          <tr class="">
            <td data-label="Input Parameter" class="slds-cell-wrap" style="vertical-align:top;" headers="d273197e96 ">
              <strong class="uicontrol">Order Summary Id</strong>
            </td>

            <td data-label="Description" class="slds-cell-wrap" style="vertical-align:top;" headers="d273197e99 ">Reference to the order summary associated with the invoice.</td>

          </tr>
        </tbody>
      </table>

Store Output Values

<table class="slds-table slds-table_bordered slds-max-medium-table_stacked slds-m-bottom_small ">
        <colgroup>
          <col style="width:17.513134851138354%">
          <col style="width:82.48686514886164%">
        </colgroup>
        <thead class="slds-text-title_caps ">
          <tr class="">
            <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d273197e179">Output Parameter</th>
            <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d273197e182">Description</th>
          </tr>
        </thead>
        <tbody>
          <tr class="">
            <td data-label="Output Parameter" class="slds-cell-wrap" style="vertical-align:top;" headers="d273197e179 ">
              <strong class="uicontrol">Ensure Funds Async Output</strong>
            </td>

            <td data-label="Description" class="slds-cell-wrap" style="vertical-align:top;" headers="d273197e182 ">
              <p>This value is an Apex-defined variable of class <a href="https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_connectapi_output_ensure_funds_async_output.htm" target="_blank">EnsureFundsAsyncOutputRepresentation</a>. 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.</p>
              <p style="margin-bottom:0;">The <strong class="uicontrol">backgroundOperationId</strong> field contains the
                ID of the background operation.</p>
            </td>

          </tr>
        </tbody>
      </table>

Usage

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

![Note](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-platform-platform_automation-264-0-0-production-enus/60568438-ec7e-4665-acd1-7c80dcbe60d5/images/icon_note.png)

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.

#### See Also

- [Create Invoice from Fulfillment Order Action](https://help.salesforce.com/s/articleView?id=platform.flow_ref_elements_om_actions_create_invoice_from_fo.htm&release=264.0.0&type=5 "In Salesforce Order Management, create an invoice for a fulfillment order that doesn’t have one.")
- [Ensure Refunds Async Action](https://help.salesforce.com/s/articleView?id=platform.flow_ref_elements_om_actions_ensure_refunds_async.htm&release=264.0.0&type=5 "In Salesforce Order Management, ensure refunds for a credit memo or excess 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.")
- [Add and Edit Elements](https://help.salesforce.com/s/articleView?id=platform.flow_build_elements.htm&release=264.0.0&type=5 "Use elements to define actions that the flow can run. When they’re on the canvas, connect them to create the order in which they run.")
- [Payment Sequencing](https://help.salesforce.com/s/articleView?id=commerce.om_impl_payment_sequencing.htm&language=en_US)