Overview
The Payment Sheet is designed to sit on top of your existing UI and provide a native checkout experience. It automatically adapts to the user’s device theme (Light/Dark) and handles all payment method logic.Installation
Basic Usage
Props
| Prop | Type | Required | Description |
|---|---|---|---|
clientSecret | string | Yes | Client secret from the payment session (cs_xxx) |
appearance | object | No | Appearance customization |
onReady | function | No | Called when the payment form is ready |
onChange | function | No | Called when form validation state changes |
onSuccess | function | No | Called when payment succeeds |
onError | function | No | Called when an error occurs |
onFocus | function | No | Called when a field gains focus |
onBlur | function | No | Called when a field loses focus |
className | string | No | Additional CSS class name |
minHeight | number | No | Minimum height of the payment form (default: 300) |
loading | boolean | No | Show loading state |
disabled | boolean | No | Disable the form |
Appearance Customization
Payment Result
On success, you receive aPaymentResult object:
Programmatic Control
Use theusePaymentSheet hook to control the payment form programmatically:
Hook Methods
| Method | Description |
|---|---|
confirm(options?) | Trigger payment confirmation |
clear() | Clear all form fields |
focus(field) | Focus a specific field (‘cardNumber’, ‘expiry’, ‘cvc’, ‘cardHolder’) |
update(options) | Update form state (disabled, loading) |
Apple Pay Integration
The Payment Sheet automatically shows Apple Pay when available:- Valid Apple Developer account
- Apple Pay merchant ID registered in Atlas dashboard
- HTTPS domain with Apple Pay domain verification
3D Secure Handling
The Payment Sheet automatically handles 3D Secure authentication. When a card requires 3DS, the SDK:- Opens the 3DS challenge in an iframe
- Handles the authentication flow
- Completes the payment automatically
- Calls
onSuccessoronErrorbased on the result