Checkout parameter examples

Below are scenario examples with using defaultSpendingCap, minimumBalanceRequired, and cartEnabled across various permutations and how the checkout page and widget will handle the parameters.

A few things to note:

  1. Slippage. Since the value of a token (even a stablecoin) can move, Loop adds a "buffer" to ensure a customer has enough allowance to make a payment. All calculations below need to be adjusted to allow for this slippage (i.e. it is not accounted for in the examples). Loop uses a buffer of 0.5% (i.e. amount 1.005).

  2. Hiding the cart: When the cart is hidden (i.e., cartEnabled=false), the minimum balance is set by whichever amount is GREATEST, between (1) the checkout amount, or (2) the minimumBalanceReqiured parameter (if set). To ensure the allowance and balance are set at your desired level, it is recommended that you also pass allowance and balance values when hiding the cart.

  3. Suggested allowance: This is an allowance amount that the checkout prompts the user's wallet to set. The suggested allowance is set by taking the highest of the 3 values below:

    1. Scheduled amount - pulls from the prices of the items in the cart that are to be paid for.

    2. Minimum balance - this is derived based on the criteria described above.

    3. defaultSpendingCap parameter - this is an optional parameter that can be passed to the checkout in order to set a custom allowance amount.

  4. Minimum allowance: At present, the minimum allowance will always match the minimum balance. This is logical as the smart contract needs permission to pull at least the amount of funds you are requiring to be in the wallet.

You can create an item in Loop that is price varies when you have a product with variable rate pricing. For example, you may charge based on monthly API calls, so the amount billed to the customer changes each month depending on their usage. Creating a price varies item allows you to collect a wallet authorization without needing to show an amount in the checkout cart.

Example scenario

The checkout is configured to have the following items in the cart:

Cart Visible

defaultSpendingCap or minimumBalanceRequired NOT set

Suggested allowanceMinimum allowance to complete checkoutMinimum balance to complete checkout

Amount

$8000

$800

$800

Calculation

$0 + (13 * $600) + $200

$0 + $600 + $200

$0 + $600 + $200

Logic

Calculated based on items in the cart

  • “price varies” item assumes $0 value

  • subscription item is 13x the item amount

  • one time item is 1x the item amount

The total for a single payment based on the combined total of the items in the cart

The total for a single payment based on the combined total of the items in the cart

defaultSpendingCap set to $2000 and minimumBalanceRequired NOT set

Suggested allowanceMinimum allowance to complete checkoutMinimum balance to complete checkout

Amount

$2000

$800

$800

Calculation

None

$0 + $600 + $200

$0 + $600 + $200

Logic

Taken directly from the defaultSpendingCap query string parameter

The total for a single payment based on the combined total of the items in the cart

The total for a single payment based on the combined total of the items in the cart

3. defaultSpendingCap NOT set and minimumBalanceRequired set to $1350

Suggested allowanceMinimum allowance to complete checkoutMinimum balance to complete checkout

Amount

$8000

$1350

$1350

Calculation

$0 + (13 * $600) + $200

None

None

Logic

Calculated based on items in the cart

  • “price varies” item assumes $0 value

  • subscription item is 13 x the item amount

  • one time item is 1 x the item amount

Taken directly from the minimumBalanceRequired query string parameter

Taken directly from the minimumBalanceRequired query string parameter

defaultSpendingCap set to $2500 and minimumBalanceRequired set to $1500

Suggested allowanceMinimum allowance to complete checkoutMinimum balance to complete checkout

Amount

$2500

$1500

$1500

Calculation

None

None

None

Logic

Taken directly from the defaultSpendingCap query string parameter

Taken directly from the minimumBalanceRequired query string parameter

Taken directly from the minimumBalanceRequired query string parameter

defaultSpendingCap set to $150 and minimumBalanceRequired set to $250

i.e. the default spending cap is < min balance required

Suggested allowanceMinimum allowance to complete checkoutMinimum balance to complete checkout

Amount

$250

$250

$250

Calculation

See logic

None

None

Logic

Because minimumBalanceRequired > defaultSpendingCap, use minimumBalanceRequired as suggested allowance

Taken directly from the minimumBalanceRequired query string parameter

Taken directly from the minimumBalanceRequired query string parameter

Cart Hidden

defaultSpendingCap or minimumBalanceRequired NOT set

Suggested allowanceMinimum allowance to complete checkoutMinimum balance to complete checkout

Amount

$800

$800

$800

Calculation

None

None

$0 + $600 + $200

Logic

Based on the minimum balance since that is highest value.

Taken from the minimum balance.

Calculate balance based on prices of items included in the checkout URL. Price varies item is considered $0.

defaultSpendingCap set to $2000 and minimumBalanceRequired NOT set

Suggested allowanceMinimum allowance to complete checkoutMinimum balance to complete checkout

Amount

$2000

$800

$800

Calculation

None

None

$0 + $600 + $200

Logic

Taken directly from the defaultSpendingCap query string parameter

Taken from the minimum balance.

Calculate balance based on prices of items included in the checkout URL. Price varies item is considered $0.

defaultSpendingCap NOT set and minimumBalanceRequired set to $1350

Suggested allowanceMinimum allowance to complete checkoutMinimum balance to complete checkout

Amount

$1350

$1350

$1350

Calculation

None

None

None

Logic

Based on the minimum balance since that is highest value.

Taken from the minimum balance.

Taken directly from the minimumBalanceRequired query string parameter

defaultSpendingCap set to $2500 and minimumBalanceRequired set to $1500

Suggested allowanceMinimum allowance to complete checkoutMinimum balance to complete checkout

Amount

$2500

$1500

$1500

Calculation

None

None

None

Logic

Taken directly from the defaultSpendingCap query string parameter

Taken directly from the minimumBalanceRequired query string parameter

Taken directly from the minimumBalanceRequired query string parameter

defaultSpendingCap set to $150 and minimumBalanceRequired set to $250

i.e. default spending cap < min balance

Suggested allowanceMinimum allowance to complete checkout

Amount

$250

$250

$250

Calculation

See logic

None

None

Logic

Because minimumBalanceRequired > defaultSpendingCap, use minimumBalanceRequired as suggested allowance

Taken directly from the minimumBalanceRequired query string parameter

Taken directly from the minimumBalanceRequired query string parameter

Last updated