On your server, create a PaymentIntentto manage the full lifecycle of the customer’s payment.
In the response, return theclientSecretandid. These will be used on the frontend to complete the payment.
Click to view API docs
| Option | Type | Default | Description |
|---|---|---|---|
layout | 'accordion' | Object | 'accordion' | Specifies the layout for the Payment Element. You can pass a string ('accordion') to use the default accordion layout, or pass an object for fine‑grained control. |
'accordion') – When you pass only the string 'accordion', the Payment Element renders using the accordion layout with its default settings.layout Object Configuration| Field | Type | Required | Default | Description |
|---|---|---|---|---|
type | String | Yes | 'accordion' | The layout style of the Payment Element. |
hideHeaderWhenSingle | Boolean | No | false | When set to true, automatically hides the accordion header if only a single payment method is available. |
| Parameter | Type | Description |
|---|---|---|
paymentIntent | Object | The resulting payment intent |
error | Object | Error object if any occurs |
error Object| Field | Type | Description |
|---|---|---|
| type | String | Type of error |
error.type Values| Value | Description |
|---|---|
no_select_payment_method | No payment method selected |
validation_error | Form validation error |
⚠️ When calling confirmPayment, always check the result status and handle accordingly.
📘 Click here to view full result code documentation
payment_method_types when creating the paymentIntent.