Documentation Index
Fetch the complete documentation index at: https://coinvoyage-3c99945b.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
PayButton is a ready-made React component that renders a themed button and manages the full payment modal experience. When a user clicks it, a modal opens that lets them select a payment method, connect their wallet, and sign the transaction. The button handles quote fetching, transaction submission, and status polling internally — your application only needs to supply the payment parameters and react to the lifecycle callbacks.
Full example
Props reference
Payment target
A pay order ID previously created on the server via the
ApiClient. Use this for SALE pay orders or any flow where the server controls order creation. When payId is set, omit toAddress, toChain, and toAmount.The destination chain ID to deposit to. Required when not using
payId.The contract address of the destination token (ERC-20, SPL, or equivalent). Omit this prop (or pass
undefined) to receive the chain’s native token (ETH, SOL, SUI, etc.).The amount of the destination token the recipient should receive, in human-readable format (e.g.,
100 for 100 USDC). Required when not using payId.The recipient address on the
toChain. Must be a valid address for the destination chain. Required when not using payId.Metadata to attach to the pay order. Supports structured item details (name, description, image, quantity, price) and up to 20 custom key-value fields.
The verb shown on the button label, such as
"Pay", "Deposit", or "Purchase". Defaults to "Pay" when not set.Appearance
Inline style overrides applied to the button element. Use this for quick branding adjustments like background color and text color.
Color scheme for the payment modal. Accepted values:
"light", "dark", or "auto". Overrides the mode set on PayKitProvider for this button only.Predefined visual theme for this button’s modal. Overrides the
theme set on PayKitProvider.Custom theme object for this button’s modal. Takes precedence over both
theme and any customTheme set on PayKitProvider.When
true, the button is rendered in a disabled state and the modal cannot be opened.When
true, the payment modal opens automatically on mount without requiring a click.Modal lifecycle
When
true, the payment modal closes automatically after the payment completes successfully.Callback invoked when the payment modal opens.
Callback invoked when the payment modal closes, whether by the user or programmatically.
Payment lifecycle
Callback invoked when the pay order cannot be created due to invalid parameters. Receives an event object with an
errorMessage string describing the failure.Callback invoked when the user sends their payment transaction and it is detected on-chain. The payment is in progress at this point but not yet confirmed.
Callback invoked when the destination transfer or contract call completes successfully. This is the appropriate place to trigger fulfillment logic or show a success message.
Callback invoked when the destination call reverts and the user’s funds are automatically refunded. Use this to notify the user of the failure.
PayButton.Custom
PayButton.Custom is for situations where you need complete control over the button’s appearance — for example, when integrating with an existing design system or triggering the modal from multiple UI elements. It accepts a render prop as children that receives show and hide functions to control modal visibility.
PayButton.Custom accepts the same payment props and lifecycle callbacks as PayButton but replaces the styling props (style, mode, theme, customTheme, disabled) with the children render prop.
Usage
Render prop
Thechildren function receives an object with two functions:
Opens the payment modal. Call this from your custom button’s
onClick handler or any other event.Closes the payment modal programmatically. Useful when you need to dismiss the modal in response to an external event.
Additional PayButton.Custom props
A render function that receives
{ show, hide }. Must return valid React elements.When
true, the payment modal opens automatically on mount.When to use
PayButton.Custom:- You need full styling control beyond what inline
styleprovides. - You are integrating into an existing design system with strict component conventions.
- You want to trigger the payment modal from multiple distinct UI elements on the same page.
- You need to open or close the modal in response to programmatic events, not only user clicks.