Checkout web component

You can use LoopCheckout as a native web component for maximum compatibility.

Usage

<loop-crypto-checkout
    payment-usd-amount="1000"
    await-confirmation="true"
    state-notification="embedded"
    onready="handleReady(event)"
></loop-crypto-checkout>

Attributes

Attribute nameDescription
payment-usd-amount (required)Payment amount in USD cents
minimum-authorization-usd-amountMinimum authorization in USD cents
suggested-authorization-usd-amountSuggested authorization (deprecated)
await-confirmationAwait on-chain confirmation
state-notification"event-only" or "embedded"
failure-notification"event-only" or "embedded"
complete-notification"event-only" or "embedded"
confirming-notification"event-only" or "embedded"
add-to-existing-authorizationAlways prompt for increasing authorization
disabledDisable UI
custom-stylesCustom CSS for this widget instance
subscription-ref-idSubscription reference ID
customer-ref-idCustomer reference ID
invoice-ref-idInvoice reference ID

Event handler attributes

AttributeEvent type
onready"ready"
onreadyfailed"readyfailed"
onstatechange"statechange"
onfailure"failure"
onwalletchange"walletchange"
onnetworkchange"networkchange"
ontokenchange"tokenchange"
onauthorizationupdated"authorizationupdated"
onauthorizationconfirmed"authorizationconfirmed"
oncreated"created"
onconfirmed"confirmed"

Quickstart Examples

HTML/JS

<loop-crypto-checkout
    payment-usd-amount="1000"
    onready="event => console.log('Ready', event)"
></loop-crypto-checkout>

Vue

<script setup>
import { onMounted, ref } from 'vue';
onMounted(() => {
  document.getElementById('checkout').addEventListener('ready', (event) => {
    console.log('Ready', event);
  });
});
</script>
<template>
  <loop-crypto-checkout id="checkout" payment-usd-amount="1000" />
</template>

Svelte

<script>
  import { onMount } from 'svelte';
  let checkout;
  onMount(() => {
    checkout.addEventListener('ready', (event) => {
      console.log('Ready', event);
    });
  });
</script>
<loop-crypto-checkout bind:this={checkout} payment-usd-amount="1000" />

See the Events section for detailed event types.