Checkout Sessions component

The CheckoutSessions component renders a customizable UI for users to connect their wallet, select a token, and complete payment for a checkout session.

Usage

import { LoopCryptoCheckout } from "@loop-crypto/checkout";

<LoopCryptoCheckout
    // Required props
    // ...see below
    // Optional event handlers and UI options
/>

Props

PropTypeDescription
couponCodeIdstringCoupon code for discounts
notificationEmailFallbackstringFallback email for notifications
addToExistingAuthorizationbooleanAlways prompt for increasing authorization
stateNotificationstring"event-only" or "embedded" (default: "event-only")
failureNotificationstring"event-only" or "embedded" (default: "event-only")
completeNotificationstring"event-only" or "embedded" (default: "event-only")
confirmingNotificationstring"event-only" or "embedded" (default: "event-only")
awaitConfirmationbooleanWait for on-chain confirmation (default: true)
disabledbooleanDisable all UI interactions
customStylesstringCustom CSS for this widget instance

Event Callbacks

Event propCallback typeDescription
onLoopCryptoCheckoutReady(event) => voidComponent is ready
onLoopCryptoCheckoutReadyFailed(event) => voidInitialization failed
onLoopCryptoCheckoutStateChange(event) => voidState changes (see below)
onLoopCryptoCheckoutFailed(event) => voidPayment failed
onLoopCryptoCheckoutTokenChange(event) => voidToken selection changed
onLoopCryptoCheckoutAuthorizationUpdated(event) => voidAuthorization updated
onLoopCryptoCheckoutAuthorizationConfirmed(event) => voidAuthorization confirmed
onLoopCryptoCheckoutCreated(event) => voidPayment created
onLoopCryptoCheckoutConfirmed(event) => voidPayment confirmed on-chain

Notification Modes

  • event-only: Only fires event callbacks (default)
  • embedded: Shows status/failure/confirmation messages in the UI

Quickstart Example

import { StrictMode } from "react";
import { createRoot } from "react-dom/client";
import { initLoopCryptoCheckout, LoopCryptoCheckout } from "@loop-crypto/checkout";

initLoopCryptoCheckout({
    checkoutSessionId: "your-checkout-session-id",
    environment: "development"
});

createRoot(document.getElementById("root")).render(
    <StrictMode>
        <LoopCryptoCheckout
            // ...props
        />
    </StrictMode>
);

See the Events section for detailed callback types and state transitions.