Skip to main content
The Buy Button frame consolidates the Apple Pay, Google Pay, and card frames into a single button. It renders the one that matches the payment method in the quote signature. When the customer taps to pay, it opens the native Apple Pay or Google Pay sheet, or runs the card pipeline directly. Behind the UI, it runs the same buy orchestration pipeline as the headless Buy frame: it evaluates transaction requirements, creates the transaction, and completes post-transaction processing. The difference is the experience. The Buy frame is headless and leaves every screen under your control. The Buy Button frame provides a visible payment button, plus the native Apple Pay or Google Pay sheet, so you can offer express checkout without building that UI yourself. The message protocol is identical to the Buy frame, so you handle the same events either way. For platform-specific walkthroughs, see manual integration: Web, React Native, Flutter, iOS, and Android.

URL

Initialization parameters

Apple Pay button settings

The Buy Button frame renders the button that matches the payment method in the quote signature. applePayButtonSettings styles the Apple Pay button variant only. It has no effect when the frame renders the card or Google Pay button. Use applePayButtonSettings to style the Apple Pay button without injecting custom CSS. Build a settings object, pass it through JSON.stringify, URL-encode the result, and append it to the frame URL. Every property is optional. Any property you omit keeps the button’s default. Dimensions accept pixels only. A bare number is treated as pixels and normalized to a px value.

Validation

Validation applies each property on its own:
  • A property with an invalid value is ignored, and the remaining valid properties still apply. Invalid values include a non-pixel dimension such as 50%, and a style, type, or locale outside its allowed set.
  • If the whole value is not valid JSON, the frame ignores applePayButtonSettings entirely and uses the defaults.

Example

This object sets a 52px-tall white button with a 26px corner radius, the buy label, and French text:
Run it through JSON.stringify, URL-encode the result, and append it to the frame URL:

Events

All events are dispatched using the message pattern described in the frames protocol. The Buy Button frame uses the same event payloads as the Buy frame; only the experience differs.

Outbound events

frame->parent These events are sent from this frame to the parent window.

handshake

The frame requests that you open a message channel.

ready

The frame finished loading and the payment button is rendered. Use this to coordinate UI transitions if needed.

buttonPressed

The customer tapped the pay button in the buy button. The frame emits this the instant the button is tapped. For Apple Pay and Google Pay, it fires before the OS presents the payment sheet (PassKit on iOS, the Google Pay sheet on Android). For card, it fires before the card pipeline runs. Treat it as an intent-to-buy signal: use it to react to the tap, for example to show a loading state or fire analytics. This event carries no payload. Route it by channelId. buttonPressed is not a purchase outcome. It still fires if the customer opens the payment sheet and then cancels, and it fires before any authorization happens. For the transaction result, listen for complete, which reports the outcome once the payment resolves.

complete

The transaction is complete. Use the transaction ID to track final status via polling.

challenge

Verification is required before the transaction can proceed. Render the challenge frame at the provided URL. Do not construct the URL yourself — use it as-is.

error

A terminal error occurred. Remove the frame and surface the message to the developer.

Inbound events

parent->frame These events are sent from the parent window to this frame.

ack

Acknowledge the handshake.

setQuote

Provide a new quote to the frame. Send this when the current quote expires before the customer completes the purchase. Pass signature as returned by the quote endpoint.