Skip to main content
The checkout components render a two-panel layout: order summary on one side, payment on the other. They support crypto and fiat, custom form fields, shipping options, discount codes, and optional B3 workflow triggers. See it live.
For the checkout sessions REST API (backend-driven, session-based flows), see Checkout Sessions. This page covers the React checkout components.

How it works

Quick start

1

Install the SDK

2

Import the component

3

Render the checkout

Basic Checkout

Components

<AnySpendCheckout>

The main checkout component renders a two-panel layout with an order summary/cart panel and a payment panel supporting crypto and fiat options. Optionally includes a form panel for collecting customer information, shipping selection, and discount codes.

Core props

string
required
Merchant wallet address to receive payment
string
required
Token contract address for settlement (e.g., USDC)
number
required
Chain ID for settlement (e.g., 8453 for Base)
CheckoutItem[]
required
Line items displayed in the cart panel

Branding

string
Merchant name shown in the checkout header
URL for the merchant logo
string
Hex color for theming (e.g., "#4f46e5")
string
Custom text for the payment button

Order summary

string
Override the computed total in wei. Use when the total differs from the sum of item amounts (e.g., after discounts or fees).
string | { amount: string; label?: string }
Shipping cost. Pass a string for amount in wei, or an object with a custom label.
string | { amount: string; label?: string; rate?: string }
Tax amount. Pass a string for amount in wei, or an object with label and optional rate display (e.g., "8.5%").
string | { amount: string; label?: string; code?: string }
Discount amount (displayed as a deduction). Pass a string for amount in wei, or an object with label and optional code.
CheckoutSummaryLine[]
Additional summary line items like platform fees, tips, or service charges

Payment

PaymentMethod
Which payment method to expand initially. Options: "crypto", "coinbase", "stripe".
string
Pre-fill the sender address to show token balances before wallet connection
string
Link this checkout to a backend checkout session for tracking

Callbacks

(result: { txHash?: string; orderId?: string }) => void
Called on successful payment
(error: Error) => void
Called on payment error
string
URL to redirect to after payment completion
string
Label for the return/redirect button

Display options

'page' | 'embedded'
default:"'page'"
page for standalone, embedded for inline within your layout
boolean
default:"false"
Show points earned in the order status summary
boolean
default:"false"
Show the order ID in the order status summary
Custom footer for the order summary. Pass null to hide the default “Powered by” footer.

Customization

AnySpendSlots
Replace UI sections. See Customization.
AnySpendContent
Override text/messages. See Customization.
AnySpendTheme
Configure colors. See Customization.
AnySpendCheckoutClasses
CSS class overrides. See Customization.

Custom forms

Collect customer information during checkout using a JSON schema or a custom React component.
CheckoutFormSchema
JSON schema defining fields to collect from the customer (email, name, address, etc.). See CheckoutFormSchema below.
React.ComponentType<CheckoutFormComponentProps>
Custom React component to render as the checkout form. Use this when formSchema isn’t flexible enough.
(data: Record<string, unknown>) => void
Called when form data changes. Form data is also automatically included in the order’s callbackMetadata.

Shipping options

ShippingOption[]
Array of shipping options to display as a radio-button selector. The selected option’s amount is automatically added to the order total.
boolean
When true, renders a shipping address form (street, city, state, zip, country). The address is included in the order’s callbackMetadata.
(option: ShippingOption) => void
Called when the user selects a shipping option

Discount codes

boolean
Show a discount code input field. Requires validateDiscount to be set.
(code: string) => Promise<DiscountResult>
Async function to validate a discount code against your backend. Returns a DiscountResult with the discount amount. The validated discount is automatically applied to the order total.
(result: DiscountResult) => void
Called when a valid discount code is applied

<AnySpendCheckoutTrigger>

Extends AnySpendCheckout with B3 workflow integration. When a user completes payment, a B3 workflow is automatically triggered with the payment data and any custom metadata.
Checkout with Workflow

Workflow props

All <AnySpendCheckout> props are supported, plus:
string
B3 workflow ID to trigger on successful payment
string
Organization ID that owns the workflow
object
Metadata merged into the order. The inputs field is accessible in workflows via {{root.result.inputs.*}}.
CheckoutItem[]
Optional for AnySpendCheckoutTrigger — if omitted, only the payment panel is shown (no cart).
string
Required when items is not provided (since there’s nothing to compute a total from).

Types

CheckoutItem

Each item in the checkout cart:
CheckoutItem

CheckoutSummaryLine

Additional line items in the order summary:
CheckoutSummaryLine

CheckoutFormSchema

Define custom form fields using a JSON schema:
CheckoutFormSchema
The "address" field type renders a full address form (street, city, state, zip, country) automatically — no need to define each sub-field.

ShippingOption

ShippingOption

DiscountResult

Returned by your validateDiscount function:
DiscountResult

AddressData

Structure for collected shipping addresses:
AddressData

CheckoutFormComponentProps

Props passed to custom form components (via formComponent or the checkoutForm slot):
CheckoutFormComponentProps

Examples

E-commerce store

Full E-Commerce Checkout

SaaS subscription

Subscription Checkout

Simple payment (no cart)

Payment-Only Checkout

Checkout with custom forms

Collect customer info, offer shipping options, and validate discount codes — all integrated into the checkout flow:
Full-Featured Checkout

Checkout with custom form component

Use a fully custom form component when the JSON schema isn’t flexible enough:
Custom Form Component

Donation / tip jar

Donation Checkout

Next steps

Checkout Sessions API

Backend-driven checkout sessions with REST API

Customization

Customize checkout with slots, content, themes, and CSS

Error Handling

Handle payment errors gracefully