The Buy frame is headless. When it emits a
challenge event, render a
separate challenge frame with
client.setupChallenge() at
the URL from the event payload. See the Handle
challenges guide for the full flow.Setup buy
Parameters
This method does not require a separate auth token. The client uses stored credentials from an active connection.
BuyEvent
onEvent receives events as the buy pipeline progresses. Use event.kind to decide how to handle each event.
FrameTransaction
This is the transaction object returned when the buy pipeline completes. FrameTransaction is a discriminated union — the failure variant carries failureReason, the non-failure variant always carries id. Pass id to client.getTransaction() to poll for the final status.
BuyChallengePayload
BuyEventError
Result
client.setupBuy() returns a Result<BuyFrame, SetupBuyError>.
Result envelope
Result<BuyFrame, SetupBuyError>
BuyFrame
SetupBuyError
Full example
The following example walks through the full card-payment flow: get a quote for a stored card, mount the headless Buy frame, hand off to a challenge frame when verification is required, and dispose of the frame when the transaction completes.Buy with a stored card
TS Definitions
TS Definitions
types.ts