old_Loopcrypto.xyz
  • Introduction
  • Supported networks and tokens
  • Loop + Frames
  • Learn
    • How Loop works
    • Core components
      • Collecting authorization
        • Enabling payment on multiple networks
        • Accepting ETH and MATIC
      • Sending payment requests
      • Checking a customer's balance & allowance
      • Receipts and reminders
      • Customer portal
    • Loop + your financial stack
      • Linking on-chain transactions with invoices in your ERP system
      • Connecting with accounting software
      • Crypto off-ramp
    • Case studies
  • Dashboard functionality
    • Subscriptions
      • Free trials, discounts and more
      • Auto-invoicing
      • Auto-cancelations
    • One-time payments
    • Scheduling outbound payments
      • Internal notes
    • Editing an upcoming payment
    • Payments for platforms
  • Integrations
    • Stripe + Loop
      • Getting setup
      • Stripe Connect setup
      • Subscriptions
        • Free trials
        • Upgrading a customer or editing a subscription's products
      • Invoicing
      • One-time payments
      • Coupon codes
      • Stripe Connect - Subscriptions
      • FAQs about Stripe integration
    • Chargebee + Loop
      • Getting setup
      • Subscriptions
      • One-time payments
      • Coupon codes
    • Quickbooks + Loop
      • Invoicing
    • Xero + Loop
      • Invoicing
    • Ghost.org + Loop
    • Zapier + Loop
    • Manually add integrations
  • Technical Docs
    • APIs
      • Entity
        • Adding child entities
        • Adding user to child entity
        • Get child entities
      • Items
        • Adding items
          • Item types
          • Categories
        • Retrieving an item
        • Updating an item
        • Deactivating an item
      • Agreements
      • Transfer requests
        • Signing transfer requests
        • Loop CLI
        • Canceling transfer requests
        • Transfer request status
        • Handling unfulfilled transfer requests
        • Validations
      • Webhooks
        • Checking webhook signatures
        • Demo App
        • Slack, Airtable, Discord, Telegram
    • Archeticture
      • Smart contract
        • Deploying your smart contract
          • Modifying smart contract properties
      • Collecting authorization
        • Checkout page
          • Additional functionality
          • Add "pay with crypto" button
        • Checkout widget
          • NPM package readme
        • Checkout parameter examples
      • Providing on-chain payment based access
        • Subscription gated communities
    • Loop SDK
      • Verify Webhook
      • Transfers
      • Error Handling
      • Generating API keys
    • Sample guide: Collect a subscription or one-time payment
    • Integrating the Loop Protocol into your dApp
      • Payroll applications
      • Loan platforms (credit cards, BNPL)
    • Security
      • API Authentication
      • Securing with signatures
      • API Trust assumptions
      • Audits
  • FAQs
  • Company Dashboard
  • Loop Portal
Powered by GitBook
On this page
  • Example scenario
  • Cart Visible
  • Cart Hidden
  1. Technical Docs
  2. Archeticture
  3. Collecting authorization

Checkout parameter examples

PreviousCheckout widgetNextProviding on-chain payment based access

Last updated 1 year ago

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 allowance
Minimum allowance to complete checkout
Minimum 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 allowance
Minimum allowance to complete checkout
Minimum 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 allowance
Minimum allowance to complete checkout
Minimum 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 allowance
Minimum allowance to complete checkout
Minimum 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 allowance
Minimum allowance to complete checkout
Minimum 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 allowance
Minimum allowance to complete checkout
Minimum 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 allowance
Minimum allowance to complete checkout
Minimum 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 allowance
Minimum allowance to complete checkout
Minimum 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 allowance
Minimum allowance to complete checkout
Minimum 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 allowance
Minimum 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