## Confirm a PaymentIntent by payment method Below are a number of methods used to confirm a PaymentIntent for a specific payment method type. ## Confirm a card payment Use `stripe.confirmCardPayment` when the customer submits your payment form. When called, it will confirm the [PaymentIntent](/api/payment_intents.md) with `data` you provide and carry out 3DS or other next actions if they are required. If you are using [Dynamic 3D Secure](/payments/3d-secure.md#three-ds-radar), `stripe.confirmCardPayment` will trigger your Radar rules to execute and may open a dialog for your customer to authenticate their payment. When you confirm a `PaymentIntent`, it needs to have an attached [PaymentMethod](/api/payment_methods.md). In addition to confirming the `PaymentIntent`, this method can automatically create and attach a new `PaymentMethod` for you. It can also be called with an existing `PaymentMethod`, or if you have already attached a `PaymentMethod` you can call this method without needing to provide any additional data. These use cases are detailed in the sections that follow. > Note that `stripe.confirmCardPayment` may take several seconds to complete. > During that time, you should disable your form from being resubmitted and show a waiting indicator like a spinner. > If you receive an error result, you should be sure to show that error to the customer, re-enable the form, and hide the waiting indicator. > > Additionally, `stripe.confirmCardPayment` may trigger a [3D Secure](/payments/3d-secure.md) authentication challenge. > This will be shown in a modal dialog and may be confusing for customers using assistive technologies like screen readers. > You should make your form accessible by ensuring that success or error messages are clearly read out after this method completes. `stripe.confirmCardPayment` will return a `Promise` which resolves with a `result` object. This object has either: * `result.paymentIntent`: the successful [PaymentIntent](/api/payment_intents). * `result.error`: an error. When the [error type](/api/errors#errors-type) is `card_error` or `validation_error`, you can display the error message in `error.message` directly to your user. Refer to the [API reference](/api#errors) for other possible errors. **Syntax:** `stripe.confirmCardPayment(...)` - `clientSecret` (string) **required** The [client secret](/api/payment_intents/object.md#payment_intent_object-client_secret) of the `PaymentIntent`. - `data` (object) Data to be sent with the request. Refer to the [Payment Intents API](/api/payment_intents/confirm.md) for a full list of parameters. - `payment_method` (string | object) Either the `id` of an existing [PaymentMethod](/api/payment_methods.md), or an object containing data to create a `PaymentMethod` with. See the use case sections below for details. - `shipping` (object) The [shipping details](/api/payment_intents/confirm.md#confirm_payment_intent-shipping) for the payment, if collected. - `return_url` (string) If you are [handling next actions yourself](/payments/payment-intents/verifying-status.md#next-actions), pass in a `return_url`. If the subsequent action is `redirect_to_url`, this URL will be used on the return path for the redirect. - `receipt_email` (string) Email address that the receipt for the resulting payment will be sent to. - `setup_future_usage` (string) Indicates that you intend to make future payments with this PaymentIntent's payment method. If present, the payment method used with this PaymentIntent can be [attached to a Customer](/api/payment_methods/attach.md), even after the transaction completes. Use `on_session` if you intend to only reuse the payment method when your customer is present in your checkout flow. Use `off_session` if your customer may or may not be in your checkout flow. See [saving card details during payment](/payments/save-during-payment.md) to learn more. Stripe uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules. For example, if your customer is impacted by [SCA](/strong-customer-authentication.md), using `off_session` will ensure that they are authenticated while processing this PaymentIntent. You will then be able to collect [off-session payments](/payments/cards/charging-saved-cards.md#off-session-payments-with-saved-cards) for this customer. - `payment_method_options` (object) An object containing payment-method-specific configuration to confirm the [PaymentIntent](/api/payment_intents.md) with. - `card` (object) Configuration for this card payment. - `cvc` (Element) Use the provided `cardCvc` [Element](/js/element.md) when confirming the PaymentIntent with an existing PaymentMethod. - `network` (string) Selected network to process this PaymentIntent on. Depends on the [available networks](/card-brand-choice.md#identifying-the-available-card-networks) of the card attached to the PaymentIntent. Can only be set at confirm-time. - `options` (object) An options object to control the behavior of this method. - `handleActions` (boolean) Set this to `false` if you want to [handle next actions yourself](/payments/payment-intents/verifying-status.md#next-actions), or if you want to defer next action handling until later (e.g. for use in the [PaymentRequest API](/stripe-js/elements/payment-request-button.md#complete-payment-intents)). Default is `true`. ### Use case: with payment data from an Element Use `stripe.confirmCardPayment` with payment data from an [Element](/js/element.md) by passing a `card` or `cardNumber` Element as `payment_method[card]` in the data argument. The new `PaymentMethod` will be created with data collected by the `Element` and will be used to confirm the `PaymentIntent`. ### Data argument properties - `payment_method` (object) **required** Pass an object to confirm using data collected by a `card` or `cardNumber` [Element](/js/element.md). - `card` (Element) **required** Uses the provided `card` or `cardNumber` [Element](/js/element.md) for confirmation. - `billing_details` (object) The [billing_details](/api/payment_methods/create.md#create_payment_method-billing_details) associated with the card. ### Confirm with an Element ```js stripe .confirmCardPayment('{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: { card: cardElement, billing_details: { name: 'Jenny Rosen', }, }, }) .then(function(result) { // Handle result.error or result.paymentIntent }); ``` ```es_next const {paymentIntent, error} = await stripe.confirmCardPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: { card: cardElement, billing_details: { name: 'Jenny Rosen', }, }, }, ); ``` ### Use case: with an existing payment method Use `stripe.confirmCardPayment` with an existing `PaymentMethod` by passing its `id` to `payment_method`. The `PaymentMethod` will be used to confirm the `PaymentIntent`. ### Data argument properties - `payment_method` (string) **required** The `id` of an existing [PaymentMethod](/api/payment_methods.md). ### Confirm with existing payment method ```js stripe .confirmCardPayment('{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: '{PAYMENT_METHOD_ID}', }) .then(function(result) { // Handle result.error or result.paymentIntent }); ``` ```es_next const {paymentIntent, error} = await stripe.confirmCardPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: '{PAYMENT_METHOD_ID}', }, ); ``` ### Use case: with an existing token For backwards compatibility, you can convert an existing `Token` into a `PaymentMethod` with `stripe.confirmCardPayment` by passing the `Token` to `payment_method[card][token]`. The newly created `PaymentMethod` will be used to confirm the `PaymentIntent`. ### Data argument properties - `payment_method` (object) **required** Pass an object to confirm using an existing token. - `card` (object) **required** An object of card data. - `token` (string) **required** Converts the provided token into a `PaymentMethod` to use for confirmation. - `billing_details` (object) The [billing_details](/api/payment_methods/create.md#create_payment_method-billing_details) associated with the card. ### Confirm with existing token ```js stripe .confirmCardPayment('{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: { card: { token: 'tok_visa', }, }, }) .then(function(result) { // Handle result.error or result.paymentIntent }); ``` ```es_next const {paymentIntent, error} = await stripe.confirmCardSetup( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: { card: { token: 'tok_visa', }, }, }, ); ``` ### Use case: with an attached PaymentMethod If you have already attached a `PaymentMethod` to this `PaymentIntent`, then you can confirm the `PaymentIntent` using `stripe.confirmCardPayment` without passing in any additional data. ### Confirm with an attached PaymentMethod ```js stripe .confirmCardPayment('{PAYMENT_INTENT_CLIENT_SECRET}') .then(function(result) { // Handle result.error or result.paymentIntent }); ``` ```es_next const {paymentIntent, error} = await stripe.confirmCardPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', ); ``` ### Confirm a card payment ```js stripe .confirmCardPayment('{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: { card: cardElement, billing_details: { name: 'Jenny Rosen', }, }, }) .then(function(result) { // Handle result.error or result.paymentIntent }); ``` ```es_next const {paymentIntent, error} = await stripe.confirmCardPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: { card: cardElement, billing_details: { name: 'Jenny Rosen', }, }, }, ); ``` ## Confirm an ACH Direct Debit payment Use `stripe.confirmUsBankAccountPayment` in the [Accept a payment flow](/payments/ach-direct-debit/accept-a-payment.md) for the [ACH Direct Debit](/payments/ach-direct-debit.md) payment method to record the customer’s authorization for payment. When you confirm a [PaymentIntent](/api/payment_intents.md), it needs to have an attached [PaymentMethod](/api/payment_methods.md). We suggest using `stripe.collectBankAccountForPayment`, which automatically collects bank account details and attaches a `PaymentMethod`. You may also choose to reuse an existing `PaymentMethod` or manually collect bank account details using the `data` parameter. These use cases are detailed in the sections that follow. `stripe.confirmUsBankAccountPayment` will return a `Promise` which resolves with a result object. This object has either: * `result.paymentIntent`: the successfully confirmed [PaymentIntent](/api/payment_intents). * `result.error`: an error. Refer to the [API reference](/api#errors) and our [integration guide](/payments/ach-direct-debit/accept-a-payment) for all possible errors. **Syntax:** `stripe.confirmUsBankAccountPayment(...)` - `clientSecret` (string) **required** The [client secret](/api/payment_intents/object.md#payment_intent_object-client_secret) of the `PaymentIntent`. - `data` (object) Data to be sent with the request. Refer to the [Payment Intents API](/api/payment_intents/confirm.md) for a full list of parameters. - `payment_method` (object | string) The `id` of an existing PaymentMethod or an object of collected data. See use cases below for details. ### Use case: with an existing PaymentMethod If you have already created a `PaymentMethod`, you can pass its `id` to `payment_method` when calling `stripe.confirmUsBankAccountPayment`. ### Data argument properties - `payment_method` (string) **required** The `id` of an existing [PaymentMethod](/api/payment_methods.md). ### Confirm with an existing PaymentMethod ```js stripe.confirmUsBankAccountPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: '{PAYMENT_METHOD_ID}', } ).then(function(result) { if (result.error) { // Inform the customer that there was an error. console.log(result.error.message); } else { // Handle next step based on PaymentIntent's status. console.log("PaymentIntent ID: " + result.paymentIntent.id); console.log("PaymentIntent status: " + result.paymentIntent.status); } }); ``` ```es_next const {paymentIntent, error} = await stripe.confirmUsBankAccountPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: '{PAYMENT_METHOD_ID}', } ); if (error) { // Inform the customer that there was an error. console.log(error.message); } else { // Handle next step based on PaymentIntent's status. console.log("PaymentIntent ID: " + paymentIntent.id); console.log("PaymentIntent status: " + paymentIntent.status); } ``` ### Use case: with an attached PaymentMethod If you have successfully called `stripe.collectBankAccountForPayment` or attached a `PaymentMethod` to this `PaymentIntent` already, then you can confirm the `PaymentIntent` without passing in any additional data. ### Confirm with an attached PaymentMethod ```js stripe.confirmUsBankAccountPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', {} ).then(function(result) { if (result.error) { // Inform the customer that there was an error. console.log(result.error.message); } else { // Handle next step based on PaymentIntent's status. console.log("PaymentIntent ID: " + result.paymentIntent.id); console.log("PaymentIntent status: " + result.paymentIntent.status); } }); ``` ```es_next const {paymentIntent, error} = await stripe.confirmUsBankAccountPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', {} ); if (error) { // Inform the customer that there was an error. console.log(error.message); } else { // Handle next step based on PaymentIntent's status. console.log("PaymentIntent ID: " + paymentIntent.id); console.log("PaymentIntent status: " + paymentIntent.status); } ``` ### Use case: with self collected bank account information If you already know the customer’s bank account information, or want to collect it yourself, you can pass them in directly to create a new `PaymentMethod` and confirm the `PaymentIntent`. ### Data argument properties - `payment_method` (object) **required** Pass an object to confirm using data collected. - `billing_details` (Object) **required** The customer's [billing_details](/api/payment_methods/create.md#create_payment_method-billing_details). `name` is required. Providing `email` allows your customer to receive [ACH Direct Debit mandate and microdeposit emails](/payments/ach-direct-debit.md#mandate-and-microdeposit-emails). - `name` (string) **required** The customer's name. The first and last name must be at minimum 2 characters each. - `email` (string) The customer's email. - `us_bank_account` (Object) **required** The customer's [bank account information](/api/payment_methods/create.md#create_payment_method-us_bank_account). - `account_number` (string) **required** The customer’s bank account number. - `routing_number` (string) **required** The routing number of the customer’s bank. - `account_holder_type` (string) **required** Account holder type: individual or company. - `account_type` (string) Account type: checkings or savings. Defaults to checking if omitted. ### Confirm with bank account information ```js stripe.confirmUsBankAccountPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: { us_bank_account: { routing_number: '110000000', account_number: '000123456789', account_holder_type: 'individual', }, billing_details: { name: 'Jenny Rosen', email: 'jenny@example.com', }, }, } ).then(function(result) { if (result.error) { // Inform the customer that there was an error. console.log(result.error.message); } else { // Handle next step based on PaymentIntent's status. console.log("PaymentIntent ID: " + result.paymentIntent.id); console.log("PaymentIntent status: " + result.paymentIntent.status); } }); ``` ```es_next const {paymentIntent, error} = await stripe.confirmUsBankAccountPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: { us_bank_account: { routing_number: '110000000', account_number: '000123456789', account_holder_type: 'individual', }, billing_details: { name: 'Jenny Rosen', email: 'jenny@example.com', }, }, } ); if (error) { // Inform the customer that there was an error. console.log(error.message); } else { // Handle next step based on PaymentIntent's status. console.log("PaymentIntent ID: " + paymentIntent.id); console.log("PaymentIntent status: " + paymentIntent.status); } ``` ### Confirm an ACH Direct Debit payment ```js stripe.confirmUsBankAccountPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: { us_bank_account: { routing_number: '110000000', account_number: '000123456789', account_holder_type: 'individual', }, billing_details: { name: 'Jenny Rosen', email: 'jenny@example.com', }, }, } ).then(function(result) { if (result.error) { // Inform the customer that there was an error. console.log(result.error.message); } else { // Handle next step based on PaymentIntent's status. console.log("PaymentIntent ID: " + result.paymentIntent.id); console.log("PaymentIntent status: " + result.paymentIntent.status); } }); ``` ```es_next const {paymentIntent, error} = await stripe.confirmUsBankAccountPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: { us_bank_account: { routing_number: '110000000', account_number: '000123456789', account_holder_type: 'individual', }, billing_details: { name: 'Jenny Rosen', email: 'jenny@example.com', }, }, } ); if (error) { // Inform the customer that there was an error. console.log(error.message); } else { // Handle next step based on PaymentIntent's status. console.log("PaymentIntent ID: " + paymentIntent.id); console.log("PaymentIntent status: " + paymentIntent.status); } ``` ## Confirm a Canadian pre-authorized debit payment Use `stripe.confirmAcssDebitPayment` in the [Accept a payment](/payments/accept-a-payment.md) flow for the [Canadian pre-authorized debit](/payments/acss-debit.md) payment method when the customer submits your payment form. When called, it will automatically load an on-page modal UI to collect bank account details and verification, accept a hosted mandate agreement, and confirm the [PaymentIntent](/api/payment_intents.md) when the user submits the form. Note that there are some additional requirements to this flow that are not covered in this reference. Refer to our [integration guide](/payments/acss-debit/accept-a-payment.md) for more details. When you confirm a `PaymentIntent`, it needs to have an attached [PaymentMethod](/api/payment_methods.md). `stripe.confirmAcssDebitPayment` automatically creates a new `PaymentMethod` for you when your customer completes the modal UI. It can also be called with an existing `PaymentMethod`, which will load the modal UI to collect a new mandate agreement. These use cases are detailed in the sections that follow. > Note that `stripe.confirmAcssDebitPayment` may take several seconds to complete. > During that time, disable your form from being resubmitted and show a waiting indicator like a spinner. > If you receive an error result, show it to the customer, re-enable the form, and hide the waiting indicator. `stripe.confirmAcssDebitPayment` will return a `Promise` which resolves with a result object. This object has either: * `result.paymentIntent`: the successfully confirmed [PaymentIntent](/api/payment_intents). * `result.error`: an error. Refer to the [API reference](/api#errors) and our [integration guide](/payments/acss-debit/accept-a-payment) for all possible errors. **Syntax:** `stripe.confirmAcssDebitPayment(...)` - `clientSecret` (string) **required** The [client secret](/api/payment_intents/object.md#payment_intent_object-client_secret) of the `PaymentIntent`. - `data` (object) Data to be sent with the request. Refer to the [Payment Intents API](/api/payment_intents/confirm.md) for a full list of parameters. - `payment_method` (object | string) The `id` of an existing PaymentMethod or an object of collected data. See use cases below for details. - `options` (object) An options object to control the behavior of this method. - `skipMandate` (boolean) Set this to `true` if you want to skip displaying the mandate confirmation. ### Use case: with a new PaymentMethod You can pass in the customer’s billing details to create a new `PaymentMethod` and confirm the `PaymentIntent`. You are required to collect and include the customer’s name and email address. This method loads an on-page modal UI that handles bank account details collection and verification, presents a hosted mandate agreement and collects authorization for you. ### Data argument properties - `payment_method` (object) **required** Pass an object to confirm using data collected. - `billing_details` (Object) **required** The customer's [billing_details](/api/payment_methods/create.md#create_payment_method-billing_details). `name` and `email` are required. - `name` (string) **required** The customer's name. The first and last name must be at minimum 2 characters each. - `email` (string) **required** The customer's email. ### Confirm with a new PaymentMethod ```js stripe.confirmAcssDebitPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: { billing_details: { name: 'Jenny Rosen', email: 'jenny@example.com', }, }, } ).then(function(result) { if (result.error) { // Inform the customer that there was an error. console.log(result.error.message); } else { // Handle next step based on PaymentIntent's status. console.log("PaymentIntent ID: " + result.paymentIntent.id); console.log("PaymentIntent status: " + result.paymentIntent.status); } }); ``` ```es_next const {paymentIntent, error} = await stripe.confirmAcssDebitPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: { billing_details: { name: 'Jenny Rosen', email: 'jenny@example.com', }, }, } ); if (error) { // Inform the customer that there was an error. console.log(error.message); } else { // Handle next step based on PaymentIntent's status. console.log("PaymentIntent ID: " + paymentIntent.id); console.log("PaymentIntent status: " + paymentIntent.status); } ``` ### Use case: with an existing PaymentMethod If you have already created a `PaymentMethod`, you can pass its `id` to `payment_method` when calling `stripe.confirmAcssDebitPayment`. This method loads an on-page modal UI that only presents a hosted mandate agreement and collects authorization for you. ### Data argument properties - `payment_method` (string) **required** The `id` of an existing [PaymentMethod](/api/payment_methods.md). ### Confirm with an existing PaymentMethod ```js stripe.confirmAcssDebitPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: '{PAYMENT_METHOD_ID}', } ).then(function(result) { if (result.error) { // Inform the customer that there was an error. console.log(result.error.message); } else { // Handle next step based on PaymentIntent's status. console.log("PaymentIntent ID: " + result.paymentIntent.id); console.log("PaymentIntent status: " + result.paymentIntent.status); } }); ``` ```es_next const {paymentIntent, error} = await stripe.confirmAcssDebitPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: '{PAYMENT_METHOD_ID}', } ); if (error) { // Inform the customer that there was an error. console.log(error.message); } else { // Handle next step based on PaymentIntent's status. console.log("PaymentIntent ID: " + paymentIntent.id); console.log("PaymentIntent status: " + paymentIntent.status); } ``` ### Use case: with an attached PaymentMethod If you have already attached a `PaymentMethod` to this `PaymentIntent`, then you can confirm the `PaymentIntent` without passing in any additional data. This method loads an on-page modal UI that only presents a hosted mandate agreement and collects authorization for you. ### Confirm with an attached PaymentMethod ```js stripe.confirmAcssDebitPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', {} ).then(function(result) { if (result.error) { // Inform the customer that there was an error. console.log(result.error.message); } else { // Handle next step based on PaymentIntent's status. console.log("PaymentIntent ID: " + result.paymentIntent.id); console.log("PaymentIntent status: " + result.paymentIntent.status); } }); ``` ```es_next const {paymentIntent, error} = await stripe.confirmAcssDebitPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', {} ); if (error) { // Inform the customer that there was an error. console.log(error.message); } else { // Handle next step based on PaymentIntent's status. console.log("PaymentIntent ID: " + paymentIntent.id); console.log("PaymentIntent status: " + paymentIntent.status); } ``` ### Use case: with self collected bank account information If you already know the customer’s bank account information, or want to collect it yourself, you can pass them in directly to create a new `PaymentMethod` and confirm the `PaymentIntent`. In this case, this method does not load the on-page modal UI, so you will need to [build your own mandate agreement page](/payments/acss-debit/custom-pad-agreement.md). ### Data argument properties - `payment_method` (object) **required** Pass an object to confirm using data collected. - `billing_details` (Object) **required** The customer's [billing_details](/api/payment_methods/create.md#create_payment_method-billing_details). `name` and `email` are required. - `name` (string) **required** The customer's name. The first and last name must be at minimum 2 characters each. - `email` (string) **required** The customer's email. - `acss_debit` (Object) **required** The customer's [bank account information](/api/payment_methods/create.md#create_payment_method-acss_debit). - `account_number` (string) **required** The customer’s bank account number. - `institution_number` (string) **required** The institution number of the customer’s bank. - `transit_number` (string) **required** The transit number of the customer’s bank. ### Confirm with bank account information ```js stripe.confirmAcssDebitPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: { acss_debit: { institution_number: '000', transit_number: '11000', account_number: '000123456789', }, billing_details: { name: 'Jenny Rosen', email: 'jenny@example.com', }, }, } ).then(function(result) { if (result.error) { // Inform the customer that there was an error. console.log(result.error.message); } else { // Handle next step based on PaymentIntent's status. console.log("PaymentIntent ID: " + result.paymentIntent.id); console.log("PaymentIntent status: " + result.paymentIntent.status); } }); ``` ```es_next const {paymentIntent, error} = await stripe.confirmAcssDebitPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: { acss_debit: { institution_number: '000', transit_number: '11000', account_number: '000123456789', }, billing_details: { name: 'Jenny Rosen', email: 'jenny@example.com', }, }, } ); if (error) { // Inform the customer that there was an error. console.log(error.message); } else { // Handle next step based on PaymentIntent's status. console.log("PaymentIntent ID: " + paymentIntent.id); console.log("PaymentIntent status: " + paymentIntent.status); } ``` ### Use case: with an existing PaymentMethod but skip mandate display If you have already created a `PaymentMethod` and built your own mandate agreement page, you can reuse it by passing its `id` to `payment_method` when calling `stripe.confirmAcssDebitPayment` and skip the on-page modal UI at the same time. ### Data and options argument paramters - `data` (object) Data to be sent with the request. - `payment_method` (string) **required** The `id` of an existing [PaymentMethod](/api/payment_methods.md). - `options` (object) An options object to control the behavior of this method. - `skipMandate` (boolean) **required** Set to `true` to skip the on-page modal UI. ### Confirm with an existing PaymentMethod but skip mandate display ```js stripe.confirmAcssDebitPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: '{PAYMENT_METHOD_ID}', }, { skipMandate: true, } ).then(function(result) { if (result.error) { // Inform the customer that there was an error. console.log(result.error.message); } else { // Handle next step based on PaymentIntent's status. console.log("PaymentIntent ID: " + result.paymentIntent.id); console.log("PaymentIntent status: " + result.paymentIntent.status); } }); ``` ```es_next const {paymentIntent, error} = await stripe.confirmAcssDebitPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: '{PAYMENT_METHOD_ID}', }, { skipMandate: true, } ); if (error) { // Inform the customer that there was an error. console.log(error.message); } else { // Handle next step based on PaymentIntent's status. console.log("PaymentIntent ID: " + paymentIntent.id); console.log("PaymentIntent status: " + paymentIntent.status); } ``` ### Confirm Canadian pre-authorized debit payment ```js stripe.confirmAcssDebitPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: { billing_details: { name: 'Jenny Rosen', email: 'jenny@example.com', }, }, } ).then(function(result) { if (result.error) { // Inform the customer that there was an error. console.log(result.error.message); } else { // Handle next step based on PaymentIntent's status. console.log("PaymentIntent ID: " + result.paymentIntent.id); console.log("PaymentIntent status: " + result.paymentIntent.status); } }); ``` ```es_next const {paymentIntent, error} = await stripe.confirmAcssDebitPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: { billing_details: { name: 'Jenny Rosen', email: 'jenny@example.com', }, }, } ); if (error) { // Inform the customer that there was an error. console.log(error.message); } else { // Handle next step based on PaymentIntent's status. console.log("PaymentIntent ID: " + paymentIntent.id); console.log("PaymentIntent status: " + paymentIntent.status); } ``` ## Confirm an Affirm payment Use `stripe.confirmAffirmPayment` in the Affirm payment method creation flow when the customer submits your payment form. When called, it will confirm the [PaymentIntent](/api/payment_intents.md) with `data` you provide, and it will automatically redirect the customer to authorize the transaction. Once authorization is complete, the customer will be redirected back to your specified `return_url`. When you confirm a `PaymentIntent`, it needs to have an attached [PaymentMethod](/api/payment_methods.md). In addition to confirming the `PaymentIntent`, this method can automatically create and attach a new `PaymentMethod` for you. If you have already attached a `PaymentMethod` you can call this method without needing to provide any additional data. These use cases are detailed in the sections that follow. > Note that `stripe.confirmAffirmPayment` may take several seconds to complete. > During that time, you should disable your form from being resubmitted and show a waiting indicator like a spinner. > If you receive an error result, you should be sure to show that error to the customer, re-enable the form, and hide the waiting indicator. By default, `stripe.confirmAffirmPayment` will trigger a redirect when successful. If there is an error, or when handling `next_action`s manually by using the `handleActions: false` option, it will return a `Promise` which resolves with a `result` object. This object has either: * `result.paymentIntent`: the successful [PaymentIntent](/api/payment_intents). * `result.error`: an error. Refer to the [API reference](/api/errors) for all possible errors. **Syntax:** `stripe.confirmAffirmPayment(...)` - `clientSecret` (string) **required** The [client secret](/api/payment_intents/object.md#payment_intent_object-client_secret) of the `PaymentIntent`. - `data` (object) Data to be sent with the request. Refer to the [Payment Intents API](/api/payment_intents/confirm.md) for a full list of parameters. - `payment_method` (string | object) Either the `id` of an existing [PaymentMethod](/api/payment_methods.md), or an object containing data to create a `PaymentMethod` with. See the use case sections below for details. - `shipping` (object) **required** The [shipping details](/api/payment_intents/confirm.md#confirm_payment_intent-shipping) for the payment. - `name` (string) **required** - `address` (object) **required** - `return_url` (string) **required** The url your customer will be directed to after they complete authentication. - `options` (object) An options object to control the behavior of this method. - `handleActions` (boolean) Set this to `false` if you want to [manually handle the authorization redirect](/payments/affirm/accept-a-payment.md#handle-redirect). Default is `true`. ### Use case: without an existing payment method If you have not already created a `PaymentMethod`, you can pass payment method parameters, and the newly created `PaymentMethod` will be used to confirm the `PaymentIntent`. ### Data argument properties - `payment_method` (object) **required** Pass payment method billing details. - `billing_details` (object) The [billing_details](/api/payment_methods/create.md#create_payment_method-billing_details) associated with the payment. - `email` (string) **required** - `name` (string) **required** - `address` (object) **required** - `shipping` (object) **required** The [shipping details](/api/payment_intents/confirm.md#confirm_payment_intent-shipping) for the payment. - `name` (string) **required** - `address` (object) **required** - `return_url` (string) **required** The url your customer will be directed to after they complete authentication. ### Confirm without existing payment method ```js stripe.confirmAffirmPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: { billing_details: { name: 'Jenny Rosen', email: 'jenny@example.com', address: { line1: '123 Main Street', city: 'San Francisco', state: 'CA', country: 'US', postal_code: '94321' } } }, shipping: { name: 'Jenny Rosen', address: { line1: '123 Main Street', city: 'San Francisco', state: 'CA', country: 'US', postal_code: '94321' } }, // Return URL where the customer should be redirected after the authorization. return_url: window.location.href } ).then(function(result) { if (result.error) { // Inform the customer that there was an error. } }); ``` ```es_next const {error} = await stripe.confirmAffirmPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: { billing_details: { name: 'Jenny Rosen', email: 'jenny@example.com', address: { line1: '123 Main Street', city: 'San Francisco', state: 'CA', country: 'US', postal_code: '94321' } } }, shipping: { name: 'Jenny Rosen', address: { line1: '123 Main Street', city: 'San Francisco', state: 'CA', country: 'US', postal_code: '94321' } }, // Return URL where the customer should be redirected after the authorization. return_url: window.location.href } ); ``` ### Use case: with an existing payment method If you have already created a `PaymentMethod`, you can pass its `id` to `payment_method` and it will be used to confirm the `PaymentIntent`. ### Data argument properties - `payment_method` (string) **required** The `id` of an existing `PaymentMethod`. - `shipping` (object) **required** The [shipping details](/api/payment_intents/confirm.md#confirm_payment_intent-shipping) for the payment. - `name` (string) **required** - `address` (object) **required** - `return_url` (string) **required** The url your customer will be directed to after they complete authentication. ### Confirm with existing payment method ```js stripe.confirmAffirmPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: '{PAYMENT_METHOD_ID}', shipping: { name: 'Jenny Rosen', address: { line1: '123 Main Street', city: 'San Francisco', state: 'CA', country: 'US', postal_code: '94321' } }, // Return URL where the customer should be redirected after the authorization. return_url: window.location.href } ).then(function(result) { // Inform the customer that there was an error. }); ``` ```es_next const {error} = await stripe.confirmAffirmPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: '{PAYMENT_METHOD_ID}', shipping: { name: 'Jenny Rosen', address: { line1: '123 Main Street', city: 'San Francisco', state: 'CA', country: 'US', postal_code: '94321' } }, // Return URL where the customer should be redirected after the authorization. return_url: window.location.href } ); ``` ### Use case: with an attached PaymentMethod If you have already attached a `return_url` and a `PaymentMethod` to this `PaymentIntent`, then you can confirm without passing in any additional data. ### Confirm with an attached PaymentMethod ```js stripe.confirmAffirmPayment( '{PAYMENT_INTENT_CLIENT_SECRET}' ).then(function(result) { if (result.error) { // Inform the customer that there was an error. } }); ``` ```es_next const {error} = await stripe.confirmAffirmPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', ); ``` ### Confirm an Affirm payment ```js stripe.confirmAffirmPayment( '{PAYMENT_INTENT_CLIENT_SECRET}' ).then(function(result) { if (result.error) { // Inform the customer that there was an error. } }); ``` ```es_next const {error} = await stripe.confirmAffirmPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', ); ``` ## Confirm an Afterpay Clearpay payment Use `stripe.confirmAfterpayClearpayPayment` in the Afterpay Clearpay payment method creation flow when the customer submits your payment form. When called, it will confirm the [PaymentIntent](/api/payment_intents.md) with `data` you provide, and it will automatically redirect the customer to authorize the transaction. Once authorization is complete, the customer will be redirected back to your specified `return_url`. When you confirm a `PaymentIntent`, it needs to have an attached [PaymentMethod](/api/payment_methods.md). In addition to confirming the `PaymentIntent`, this method can automatically create and attach a new `PaymentMethod` for you. If you have already attached a `PaymentMethod` you can call this method without needing to provide any additional data. These use cases are detailed in the sections that follow. > Note that `stripe.confirmAfterpayClearpayPayment` may take several seconds to complete. > During that time, you should disable your form from being resubmitted and show a waiting indicator like a spinner. > If you receive an error result, you should be sure to show that error to the customer, re-enable the form, and hide the waiting indicator. By default, `stripe.confirmAfterpayClearpayPayment` will trigger a redirect when successful. If there is an error, or when handling `next_action`s manually by using the `handleActions: false` option, it will return a `Promise` which resolves with a `result` object. This object has either: * `result.paymentIntent`: the successful [PaymentIntent](/api/payment_intents). * `result.error`: an error. Refer to the [API reference](/api/errors) for all possible errors. **Syntax:** `stripe.confirmAfterpayClearpayPayment(...)` - `clientSecret` (string) **required** The [client secret](/api/payment_intents/object.md#payment_intent_object-client_secret) of the `PaymentIntent`. - `data` (object) Data to be sent with the request. Refer to the [Payment Intents API](/api/payment_intents/confirm.md) for a full list of parameters. - `payment_method` (string | object) Either the `id` of an existing [PaymentMethod](/api/payment_methods.md), or an object containing data to create a `PaymentMethod` with. See the use case sections below for details. - `return_url` (string) **required** The url your customer will be directed to after they complete authentication. - `options` (object) An options object to control the behavior of this method. - `handleActions` (boolean) Set this to `false` if you want to [manually handle the authorization redirect](/payments/afterpay-clearpay/accept-a-payment.md#handle-redirect). Default is `true`. ### Use case: without an existing payment method If you have not already created a `PaymentMethod`, you can pass payment method parameters, and the newly created `PaymentMethod` will be used to confirm the `PaymentIntent`. ### Data argument properties - `payment_method` (object) **required** Pass payment method billing details. - `billing_details` (object) **required** The [billing_details](/api/payment_methods/create.md#create_payment_method-billing_details) associated with the payment. - `email` (string) **required** - `name` (string) **required** - `address` (object) **required** - `shipping` (object) The [shipping details](/api/payment_intents/confirm.md#confirm_payment_intent-shipping) for the payment. - `name` (string) **required** - `address` (object) **required** - `return_url` (string) **required** The url your customer will be directed to after they complete authentication. ### Confirm without existing payment method ```js stripe.confirmAfterpayClearpayPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: { billing_details: { name: 'Jenny Rosen', email: 'jenny@example.com', address: { line1: '123 Main Street', city: 'San Francisco', state: 'CA', country: 'US', postal_code: '94321' } } }, shipping: { name: 'Jenny Rosen', address: { line1: '123 Main Street', city: 'San Francisco', state: 'CA', country: 'US', postal_code: '94321' } }, // Return URL where the customer should be redirected after the authorization. return_url: window.location.href } ).then(function(result) { if (result.error) { // Inform the customer that there was an error. } }); ``` ```es_next const {error} = await stripe.confirmAfterpayClearpayPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: { billing_details: { name: 'Jenny Rosen', email: 'jenny@example.com', address: { line1: '123 Main Street', city: 'San Francisco', state: 'CA', country: 'US', postal_code: '94321' } } }, shipping: { name: 'Jenny Rosen', address: { line1: '123 Main Street', city: 'San Francisco', state: 'CA', country: 'US', postal_code: '94321' } }, // Return URL where the customer should be redirected after the authorization. return_url: window.location.href } ); ``` ### Use case: with an existing payment method If you have already created a `PaymentMethod`, you can pass its `id` to `payment_method` and it will be used to confirm the `PaymentIntent`. ### Data argument properties - `payment_method` (string) **required** The `id` of an existing `PaymentMethod`. - `return_url` (string) **required** The url your customer will be directed to after they complete authentication. ### Confirm with existing payment method ```js stripe.confirmAfterpayClearpayPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: '{PAYMENT_METHOD_ID}', // Return URL where the customer should be redirected after the authorization. return_url: window.location.href } ).then(function(result) { // Inform the customer that there was an error. }); ``` ```es_next const {error} = await stripe.confirmAfterpayClearpayPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: '{PAYMENT_METHOD_ID}', // Return URL where the customer should be redirected after the authorization. return_url: window.location.href } ); ``` ### Use case: with an attached PaymentMethod If you have already attached a `return_url` and a `PaymentMethod` to this `PaymentIntent`, then you can confirm without passing in any additional data. ### Confirm with an attached PaymentMethod ```js stripe.confirmAfterpayClearpayPayment( '{PAYMENT_INTENT_CLIENT_SECRET}' ).then(function(result) { if (result.error) { // Inform the customer that there was an error. } }); ``` ```es_next const {error} = await stripe.confirmAfterpayClearpayPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', ); ``` ### Confirm an Afterpay Clearpay payment ```js stripe.confirmAfterpayClearpayPayment( '{PAYMENT_INTENT_CLIENT_SECRET}' ).then(function(result) { if (result.error) { // Inform the customer that there was an error. } }); ``` ```es_next const {error} = await stripe.confirmAfterpayClearpayPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', ); ``` ## Confirm an Alipay payment Use `stripe.confirmAlipayPayment` in the Alipay payment method creation flow when the customer submits your payment form. When called, it will confirm the [PaymentIntent](/api/payment_intents.md) with `data` you provide, and it will automatically redirect the customer to authorize the transaction. Once authorization is complete, the customer will be redirected back to your specified `return_url`. When you confirm a `PaymentIntent`, it needs to have an attached [PaymentMethod](/api/payment_methods.md). In addition to confirming the `PaymentIntent`, this method can automatically create and attach a new `PaymentMethod` for you. If you have already attached a `PaymentMethod` you can call this method without needing to provide any additional data. These use cases are detailed in the sections that follow. > Note that `stripe.confirmAlipayPayment` may take several seconds to complete. > During that time, you should disable your form from being resubmitted and show a waiting indicator like a spinner. > If you receive an error result, you should be sure to show that error to the customer, re-enable the form, and hide the waiting indicator. By default, `stripe.confirmAlipayPayment` will trigger a redirect when successful. If there is an error, or when handling `next_action`s manually by using the `handleActions: false` option, it will return a `Promise` which resolves with a `result` object. This object has either: * `result.paymentIntent`: the successful [PaymentIntent](/api/payment_intents). * `result.error`: an error. Refer to the [API reference](/api/errors) for all possible errors. **Syntax:** `stripe.confirmAlipayPayment(...)` - `clientSecret` (string) **required** The [client secret](/api/payment_intents/object.md#payment_intent_object-client_secret) of the `PaymentIntent`. - `data` (object) Data to be sent with the request. Refer to the [Payment Intents API](/api/payment_intents/confirm.md) for a full list of parameters. - `payment_method` (string | object) The `id` of an existing [PaymentMethod](/api/payment_methods.md). See the use case sections below for details. - `return_url` (string) The url your customer will be directed to after they complete authentication. - `options` (object) An options object to control the behavior of this method. - `handleActions` (boolean) Set this to `false` if you want to [manually handle the authorization redirect](/payments/ideal.md#handle-redirect). Default is `true`. ### Use case: Without an existing payment method If you have not already created a `PaymentMethod`, the newly created `PaymentMethod` will be used to confirm the `PaymentIntent`. ### Data argument properties - `return_url` (string) The url your customer will be directed to after they complete authentication. ### Confirm without existing payment method ```js stripe.confirmAlipayPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { // Return URL where the customer should be redirected after the authorization. return_url: window.location.href } ).then(function(result) { if (result.error) { // Inform the customer that there was an error. } }); ``` ```es_next const {error} = await stripe.confirmAlipayPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { // Return URL where the customer should be redirected after the authorization. return_url: window.location.href } ); ``` ### Use case: With an existing payment method If you have already created a `PaymentMethod`, you can pass its `id` to `payment_method` and it will be used to confirm the `PaymentIntent`. ### Data argument properties - `payment_method` (string) **required** The `id` of an existing `PaymentMethod`. - `return_url` (string) The url your customer will be directed to after they complete authentication. ### Confirm with existing payment method ```js stripe.confirmAlipayPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: '{PAYMENT_METHOD_ID}', // Return URL where the customer should be redirected after the authorization. return_url: window.location.href } ).then(function(result) { // Inform the customer that there was an error. }); ``` ```es_next const {error} = await stripe.confirmAlipayPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: '{PAYMENT_METHOD_ID}', // Return URL where the customer should be redirected after the authorization. return_url: window.location.href } ); ``` ### Use case: With an attached PaymentMethod If you have already attached a `return_url` and a `PaymentMethod` to this `PaymentIntent`, then you can confirm without passing in any additional data. ### Confirm with an attached PaymentMethod ```js stripe.confirmAlipayPayment( '{PAYMENT_INTENT_CLIENT_SECRET}' ).then(function(result) { if (result.error) { // Inform the customer that there was an error. } }); ``` ```es_next const {error} = await stripe.confirmAlipayPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', ); ``` ### Confirm an Alipay payment ```js stripe.confirmAlipayPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { // Return URL where the customer should be redirected after the authorization. return_url: window.location.href } ).then(function(result) { if (result.error) { // Inform the customer that there was an error. } }); ``` ```es_next const {error} = await stripe.confirmAlipayPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { // Return URL where the customer should be redirected after the authorization. return_url: window.location.href } ); ``` ## Confirm a BECS Debit payment Use `stripe.confirmAuBecsDebitPayment` in the [BECS Direct Debit Payments](/payments/au-becs-debit.md) with Payment Methods flow when the customer submits your payment form. When called, it will confirm the [PaymentIntent](/api/payment_intents.md) with `data` you provide. Note that there are some additional requirements to this flow that are not covered in this reference. Refer to our [integration guide](/payments/au-becs-debit.md) for more details. When you confirm a `PaymentIntent`, it needs to have an attached [PaymentMethod](/api/payment_methods.md). In addition to confirming the `PaymentIntent`, this method can automatically create and attach a new PaymentMethod for you. If you have already attached a `PaymentMethod` you can call this method without needing to provide any additional data. These use cases are detailed in the sections that follow. > Note that `stripe.confirmAuBecsDebitPayment` may take several seconds to complete. > During that time, you should disable your form from being resubmitted and show a waiting indicator like a spinner. > If you receive an error result, you should be sure to show that error to the customer, re-enable the form, and hide the waiting indicator. `stripe.confirmAuBecsDebitPayment` will return a `Promise` which resolves with a result object. This object has either: * `result.paymentIntent`: the successful PaymentIntent. * `result.error`: an error. Refer to the API reference for all possible errors. **Syntax:** `stripe.confirmAuBecsDebitPayment(...)` - `clientSecret` (string) **required** The [client secret](/api/payment_intents/object.md#payment_intent_object-client_secret) of the `PaymentIntent`. - `data` (object) Data to be sent with the request. Refer to the [Payment Intents API](/api/payment_intents/confirm.md) for a full list of parameters. - `payment_method` (object | string) The `id` of an existing PaymentMethod or an object of collected data. See use cases below for details. - `setup_future_usage` (string) To set up the BECS Direct Debit account for reuse, set this parameter to `off_session`. BECS Direct Debit only accepts an `off_session` value for this parameter. If a `customer` is provided on this [PaymentIntent](/api/payment_intents.md), the [PaymentMethod](/api/payment_methods.md) will be attached to the customer when the PaymentIntent transitions to `processing`. ### Use case: with payment data from an Element Create and attach a new PaymentMethod with `stripe.confirmAuBecsDebitPayment` by passing an `auBankAccount` [Element](/js/element.md) to `payment_method[au_becs_debit]`. The new `PaymentMethod` will be created with the data collected by the `Element` and will be used to confirm the `PaymentIntent`. Additionally, to create a BECS Direct Debit `PaymentMethod`, you are required to collect and include the account holder's name and the customer's email address. ### Data argument properties - `payment_method` (object) **required** Pass an `object` to confirm the payment using data collected by an `auBankAccount` [Element](/js/element.md). - `au_becs_debit` (Element) **required** An `auBankAccount` Element. - `billing_details` (Object) **required** The customer's [billing_details](/api/payment_methods/create.md#create_payment_method-billing_details). `name` and `email` are required. - `name` (string) **required** The account holder's name. - `email` (string) **required** The customer's email. ### Confirm with an Element ```js stripe .confirmAuBecsDebitPayment('{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: { au_becs_debit: auBankAccountElement, billing_details: { name: 'John Smith', email: 'john.smith@example.com', }, }, }) .then(function(result) { // Handle result.error or result.paymentIntent }); ``` ```es_next const {paymentIntent, error} = await stripe.confirmAuBecsDebitPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: { au_becs_debit: auBankAccountElement, billing_details: { name: 'John Smith', email: 'john.smith@example.com', }, }, }, ); ``` ### Use case: with self collected data If you already know the customer’s BSB number and bank account number or want to collect it yourself, then you do not need to use the `auBankAccount` Element with `stripe.confirmAuBecsDebitPayment`. You can pass in the customer’s bank account information directly to create a new `PaymentMethod` and confirm the `PaymentIntent`. To create a BECS Direct Debit `PaymentMethod`, you are required to collect and include the account holder's name and the customer's email address. ### Data argument properties - `payment_method` (object) **required** Pass an object to confirm using data collected without an `Element`. - `au_becs_debit` (object) **required** - `bsb_number` (string) **required** A Bank State Branch (BSB) number. - `account_number` (string) **required** A bank account number. - `billing_details` (Object) **required** The customer's [billing_details](/api/payment_methods/create.md#create_payment_method-billing_details). `name` and `email` are required. - `name` (string) **required** The account holder's name. - `email` (string) **required** The customer's email. ### Confirm with self collected data ```js stripe .confirmAuBecsDebitPayment('{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: { au_becs_debit: { bsb_number: '000000', account_number: '000123456' }, billing_details: { name: 'John Smith', email: 'john.smith@example.com', }, }, }) .then(function(result) { // Handle result.error or result.paymentIntent }); ``` ```es_next const {paymentIntent, error} = await stripe.confirmAuBecsDebitPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: { au_becs_debit: { bsb_number: '000000', account_number: '000123456' }, billing_details: { name: 'John Smith', email: 'john.smith@example.com', }, }, }, ); ``` ### Use case: with an existing payment method If you have already created a `PaymentMethod`, you can pass its `id` to `payment_method` when calling `stripe.confirmAuBecsDebitPayment`. It will be used to confirm the `PaymentIntent`. ### Data argument properties - `payment_method` (string) **required** The `id` of an existing [PaymentMethod](/api/payment_methods.md). ### Confirm with existing payment method ```js stripe .confirmAuBecsDebitPayment('{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: '{PAYMENT_METHOD_ID}', }) .then(function(result) { // Handle result.error or result.paymentIntent }); ``` ```es_next const {paymentIntent, error} = await stripe.confirmAuBecsDebitPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: '{PAYMENT_METHOD_ID}', }, ); ``` ### Use case: with an attached PaymentMethod If you have already attached a `PaymentMethod` to this `PaymentIntent`, then you can confirm the `PaymentIntent` using `stripe.confirmAuBecsDebitPayment` without passing in any additional data. ### Confirm with an attached PaymentMethod ```js stripe .confirmAuBecsDebitPayment('{PAYMENT_INTENT_CLIENT_SECRET}') .then(function(result) { // Handle result.error or result.paymentIntent }); ``` ```es_next const {paymentIntent, error} = await stripe.confirmAuBecsDebitPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', ); ``` ### Confirm a BECS Debit payment ```js stripe .confirmAuBecsDebitPayment('{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: { au_becs_debit: auBankAccountElement, billing_details: { name: 'John Smith', email: 'john.smith@example.com', }, }, }) .then(function(result) { // Handle result.error or result.paymentIntent }); ``` ```es_next const {paymentIntent, error} = await stripe.confirmAuBecsDebitPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: { au_becs_debit: auBankAccountElement, billing_details: { name: 'John Smith', email: 'john.smith@example.com', }, }, }, ); ``` ## Confirm a Bancontact payment Use `stripe.confirmBancontactPayment` in the [Bancontact Payments with Payment Methods](/payments/bancontact/accept-a-payment.md) flow when the customer submits your payment form. When called, it will confirm the `PaymentIntent` with `data` you provide, and it will automatically redirect the customer to authorize the transaction. Once authorization is complete, the customer will be redirected back to your specified `return_url`. When you confirm a `PaymentIntent`, it needs to have an attached [PaymentMethod](/api/payment_methods.md). In addition to confirming the `PaymentIntent`, this method can automatically create and attach a new `PaymentMethod` for you. If you have already attached a `PaymentMethod` you can call this method without needing to provide any additional data. These use cases are detailed in the sections that follow. > Note that `stripe.confirmBancontactPayment` may take several seconds to complete. > During that time, you should disable your form from being resubmitted and show a waiting indicator like a spinner. > If you receive an error result, you should be sure to show that error to the customer, re-enable the form, and hide the waiting indicator. `stripe.confirmBancontactPayment` will trigger a redirect when successful. If there is an error, it will return a `Promise` which resolves with a `result` object. This object has either: * `result.paymentIntent`: the successful [PaymentIntent](/api/payment_intents). * `result.error`: an error. Refer to the [API reference](/api/errors) for all possible errors. **Syntax:** `stripe.confirmBancontactPayment(...)` - `clientSecret` (string) **required** The [client secret](/api/payment_intents/object.md#payment_intent_object-client_secret) of the `PaymentIntent`. - `data` (object) Data to be sent with the request. Refer to the [Payment Intents API](/api/payment_intents/confirm.md) for a full list of parameters. - `payment_method` (string | object) Either the `id` of an existing [PaymentMethod](/api/payment_methods.md), or an object containing data to create a `PaymentMethod` with. See the use case sections below for details. - `return_url` (string) The url your customer will be directed to after they complete authentication. - `setup_future_usage` (string) To set up a SEPA Direct Debit payment method using the bank details from this Bancontact payment, set this parameter to `off_session`. When using this parameter, a `customer` will need to be set on the [PaymentIntent](/api/payment_intents.md). The newly created SEPA Direct Debit [PaymentMethod](/api/payment_methods.md) will be attached to this customer. - `options` (object) An options object to control the behavior of this method. - `handleActions` (boolean) Set this to `false` if you want to [manually handle the authorization redirect](/payments/bancontact/accept-a-payment?platform=web.md#handle-redirect). Default is `true`. ### Use case: with an existing payment method Use `stripe.confirmBancontactPayment` with an existing `PaymentMethod` by passing its `id` to `payment_method`. The `PaymentMethod` will be used to confirm the `PaymentIntent`. ### Data argument properties - `payment_method` (string) **required** The `id` of an existing `PaymentMethod`. - `return_url` (string) The url your customer will be directed to after they complete authentication. - `setup_future_usage` (string) To set up a SEPA Direct Debit payment method using the bank details from this Bancontact payment, set this parameter to `off_session`. When using this parameter, a `customer` will need to be set on the [PaymentIntent](/api/payment_intents.md). The newly created SEPA Direct Debit [PaymentMethod](/api/payment_methods.md) will be attached to this customer. ### Confirm with existing payment method ```js stripe .confirmBancontactPayment('{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: '{PAYMENT_METHOD_ID}', // Return URL where the customer should be redirected after the authorization. return_url: window.location.href, }) .then(function(result) { // Inform the customer that there was an error. }); ``` ```es_next const {error} = await stripe.confirmBancontactPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: '{PAYMENT_METHOD_ID}', // Return URL where the customer should be redirected after the authorization. return_url: window.location.href, }, ); ``` ### Use case: with collected data Your customer's name is required for the Bancontact authorization to succeed. You can pass in the customer’s name directly to create a new `PaymentMethod` and confirm the `PaymentIntent`. ### Data argument properties - `payment_method` (object) **required** Pass an object to confirm with the customer's name. - `billing_details` (object) **required** An object detailing billing information. - `name` (string) **required** The customer's name. - `email` (string) The customer's email. Required when `setup_future_usage` is set to `off_session`. - `return_url` (string) The url your customer will be directed to after they complete authentication. - `setup_future_usage` (string) To set up a SEPA Direct Debit payment method using the bank details from this Bancontact payment, set this parameter to `off_session`. When using this parameter, a `customer` will need to be set on the [PaymentIntent](/api/payment_intents.md). The newly created SEPA Direct Debit [PaymentMethod](/api/payment_methods.md) will be attached to this customer. ### Confirm with self collected data ```js stripe .confirmBancontactPayment('{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: { billing_details: { name: 'Jenny Rosen', }, }, // Return URL where the customer should be redirected after the authorization. return_url: window.location.href, }) .then(function(result) { if (result.error) { // Inform the customer that there was an error. } }); ``` ```es_next const {error} = await stripe.confirmBancontactPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: { billing_details: { name: 'Jenny Rosen', }, }, // Return URL where the customer should be redirected after the authorization. return_url: window.location.href, }, ); ``` ### Use case: with an attached PaymentMethod If you have already attached a `PaymentMethod` to this `PaymentIntent`, then you can confirm the `PaymentIntent` using `stripe.confirmBancontactPayment` without passing in any additional data. ### Confirm with an attached PaymentMethod ```js stripe .confirmBancontactPayment('{PAYMENT_INTENT_CLIENT_SECRET}') .then(function(result) { // Handle result.error or result.paymentIntent }); ``` ```es_next const {paymentIntent, error} = await stripe.confirmBancontactPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', ); ``` ### Confirm a Bancontact payment ```js stripe .confirmBancontactPayment('{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: { billing_details: { name: 'Jenny Rosen', }, }, // Return URL where the customer should be redirected after the authorization. return_url: window.location.href, }) .then(function(result) { if (result.error) { // Inform the customer that there was an error. } }); ``` ```es_next const {error} = await stripe.confirmBancontactPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: { billing_details: { name: 'Jenny Rosen', }, }, // Return URL where the customer should be redirected after the authorization. return_url: window.location.href, }, ); ``` ## Confirm a BLIK payment Use `stripe.confirmBlikPayment` in the [BLIK Payments with Payment Methods](/payments/blik.md) flow when the customer submits your payment form. When called, it will confirm the `PaymentIntent` with `data` you provide, and it will automatically prompt the customer to authorize the transaction. > Note that `stripe.confirmBlikPayment` may take several seconds to complete. > During that time, you should disable your form from being resubmitted and show a waiting indicator like a spinner. > If you receive an error result, you should be sure to show that error to the customer, re-enable the form, and hide the waiting indicator. By default, `stripe.confirmBlikPayment` will only return when the payment has succeeded or failed. If there is an error, or when handling next actions manually by using the `handleActions: false` option, it will return a `Promise` which resolves with a `result` object. This object has either: * `result.paymentIntent`: the successful [PaymentIntent](/api/payment_intents). * `result.error`: an error. Refer to the [API reference](/api/errors) for all possible errors. **Syntax:** `stripe.confirmBlikPayment(...)` - `clientSecret` (string) **required** The [client secret](/api/payment_intents/object.md#payment_intent_object-client_secret) of the `PaymentIntent`. - `data` (object) **required** Data to be sent with the request. Refer to the [Payment Intents API](/api/payment_intents/confirm.md) for a full list of parameters. - `payment_method_options` (object) **required** An object that contains transaction specific data. - `code` (string) **required** Your customer's 6-digit BLIK code. - `payment_method` (object) Use this parameter to supply additional data relevant to the transaction, such as billing details. - `billing_details` (object) The [billing details](/api/payment_methods/create.md#create_payment_method-billing_details) associated with the transaction. - `options` (object) An options object to control the behavior of this method. - `handleActions` (boolean) Set this to `false` if you want to manually determine if the confirmation has succeeded or failed. ### Confirm a BLIK payment ```js stripe .confirmBlikPayment('{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: { blik: {}, billing_details: {} }, payment_method_options: { blik: { code: '{CODE}' } } }) .then(function(result) { if (result.error) { // Inform the customer that there was an error. } }); ``` ```es_next const {error} = await stripe.confirmBlikPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: { blik: {}, billing_details: {} }, payment_method_options: { blik: { code: '{CODE}' } } } ); ``` ## Confirm a Boleto payment Use `stripe.confirmBoletoPayment` in the [Boleto Payment](/payments/boleto.md) with Payment Methods flow when the customer submits your payment form. When called, it will confirm the [PaymentIntent](/api/payment_intents.md) with `data` you provide. Note that there are some additional requirements to this flow that are not covered in this reference. Refer to our [integration guide](/payments/boleto.md) for more details. When you confirm a `PaymentIntent`, it needs to have an attached [PaymentMethod](/api/payment_methods.md). In addition to confirming the `PaymentIntent`, this method can automatically create and attach a new PaymentMethod for you. If you have already attached a `PaymentMethod` you can call this method without needing to provide any additional data. These use cases are detailed in the sections that follow. > Note that `stripe.confirmBoletoPayment` may take several seconds to complete. > During that time, you should disable your form from being resubmitted and show a waiting indicator like a spinner. > If you receive an error result, you should be sure to show that error to the customer, re-enable the form, and hide the waiting indicator. `stripe.confirmBoletoPayment` will return a `Promise` which resolves with a result object. This object has either: * `result.paymentIntent`: the successful PaymentIntent. * `result.error`: an error. Refer to the API reference for all possible errors. **Syntax:** `stripe.confirmBoletoPayment(...)` - `clientSecret` (string) **required** The [client secret](/api/payment_intents/object.md#payment_intent_object-client_secret) of the `PaymentIntent`. - `data` (object) Data to be sent with the request. Refer to the [Payment Intents API](/api/payment_intents/confirm.md) for a full list of parameters. - `payment_method` (object | string) The `id` of an existing PaymentMethod or an object of collected data. See use cases below for details. - `options` (object) An options object to control the behavior of this method. - `handleActions` (boolean) **required** Set to `false`. The Boleto private beta does not handle the next actions for you automatically (e.g. display Boleto details). Please refer to our [Stripe Boleto integration guide](/payments/boleto.md) for more info. ### Use case: with collected data You can pass in the customer’s billing details to create a new `PaymentMethod` and confirm the `PaymentIntent`. To create a Boleto `PaymentMethod`, you are required to collect and include the customer’s name, email, Brazilian tax id (CPF/CNPJ) and address. ### Data argument properties - `payment_method` (object) **required** Pass an object to confirm using data collected. - `boleto` (Object) **required** - `tax_id` (string) **required** The customer's Brazilian tax id (CPF/CNPJ). - `billing_details` (Object) **required** The customer's [billing_details](/api/payment_methods/create.md#create_payment_method-billing_details). `name`, `email` and `address`. - `name` (string) **required** The customer's name. The first and last name must be at minimum 2 characters each. - `email` (string) **required** The customer's email. - `address` (string) **required** The customer's address: street name, city, state and postal code - `line1` (string) **required** The customer's address line 1 (e.g. street or company name). - `line2` (string) The customer's address line 2 (e.g. apartment, suite, unit, or building). - `city` (string) **required** The customer's address city (e.g. Sao Paulo). - `state` (string) **required** The customer's address state (e.g. SP). - `postal_code` (string) **required** The customer's CEP (i.e. Brazilian postal code). Must be 8 digits long. - `country` (string) **required** Must be BR. ### Confirm with collected data ```js stripe.confirmBoletoPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: { boleto: { tax_id: '000.000.000-00' }, billing_details: { name: 'Fulaninho de Silva', email: 'fulaninho@example.com', address: { line1: '1234 Avenida Paulista', city: 'Sao Paulo', state: 'SP', postal_code: '01310100', country: 'BR', }, }, }, }, { handleActions: false, } ).then(function(result) { // Handle result.error or result.paymentIntent }); ``` ```es_next const {paymentIntent, error} = await stripe.confirmBoletoPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: { boleto: { tax_id: '000.000.000-00' }, billing_details: { name: 'Fulaninho de Silva', email: 'fulaninho@example.com', address: { line1: '1234 Avenida Paulista', city: 'Sao Paulo', state: 'SP', postal_code: '01310100', country: 'BR', }, }, }, }, { handleActions: false, } ); ``` ### Use case: with an existing payment method If you have already created a `PaymentMethod`, you can pass its `id` to `payment_method` when calling `stripe.confirmBoletoPayment`. It will be used to confirm the `PaymentIntent`. ### Data argument properties - `payment_method` (string) **required** The `id` of an existing [PaymentMethod](/api/payment_methods.md). ### Confirm with existing payment method ```js stripe.confirmBoletoPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: '{PAYMENT_METHOD_ID}', }, { handleActions: false, } ).then(function(result) { // Handle result.error or result.paymentIntent }); ``` ```es_next const {paymentIntent, error} = await stripe.confirmBoletoPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: '{PAYMENT_METHOD_ID}', }, { handleActions: false, } ); ``` ### Use case: with an attached PaymentMethod If you have already attached a `PaymentMethod` to this `PaymentIntent`, then you can confirm the `PaymentIntent` using `stripe.confirmBoletoPayment` without passing in any additional data. ### Confirm with an attached PaymentMethod ```js stripe.confirmBoletoPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', {}, { handleActions: false, } ).then(function(result) { // Handle result.error or result.paymentIntent }); ``` ```es_next const {paymentIntent, error} = await stripe.confirmBoletoPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', {}, { handleActions: false, } ); ``` ### Confirm a Boleto payment ```js stripe.confirmBoletoPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: { boleto: { tax_id: '000.000.000-00' }, billing_details: { name: 'Fulaninho de Silva', email: 'fulaninho@example.com', address: { line1: '1234 Avenida Paulista', city: 'Sao Paulo', state: 'SP', postal_code: '01310100', country: 'BR', }, }, }, }, { handleActions: false, } ).then(function(result) { // Handle result.error or result.paymentIntent }); ``` ```es_next const {paymentIntent, error} = await stripe.confirmBoletoPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: { boleto: { tax_id: '000.000.000-00' }, billing_details: { name: 'Fulaninho de Silva', email: 'fulaninho@example.com', address: { line1: '1234 Avenida Paulista', city: 'Sao Paulo', state: 'SP', postal_code: '01310100', country: 'BR', }, }, }, }, { handleActions: false, } ); ``` ## Confirm a Customer Balance payment Use `stripe.confirmCustomerBalancePayment` in the [Customer Balance](/payments/customer-balance.md) payment flow when the customer submits your payment form. When called, it will confirm the [PaymentIntent](/api/payment_intents.md) with `data` you provide. Refer to our [integration guide](/payments/bank-transfers/accept-a-payment.md) for more details. Since the [Customer Balance](/payments/customer-balance.md) payment method draws from a balance, the attempt will succeed or fail depending on the current balance amount. To collect more funds from the customer when the cash balance is insufficient, use the customer balance with [bank transfer funding](/payments/bank-transfers/accept-a-payment.md) parameters. The confirmation attempt will finish in one of the following result states: 1. If the customer balance is greater than or equal to the amount, the PaymentIntent response will have a `status` of `succeeded`. The `funding_type` will be ignored. 2. If the customer balance is less than the amount, and you do not set the `funding_type`, the PaymentIntent response will have a `status` of `requires_payment_method`. 3. If the customer balance is less than the amount, and you set the `funding_type`, the PaymentIntent response will have a `status` of `requires_action`. The `paymentIntent.next_action.display_bank_transfer_instructions` hash will contain bank transfer details for funding the [Customer Balance](/payments/customer-balance.md). > Note that `stripe.confirmCustomerBalancePayment` may take several seconds to complete. > During that time, you should disable your form from being resubmitted and show a waiting indicator like a spinner. > If you receive an error result, you should be sure to show that error to the customer, re-enable the form, and hide the waiting indicator. `stripe.confirmCustomerBalancePayment` will return a `Promise` which resolves with a result object. This object has either: * `result.paymentIntent`: when the [Customer Balance](/payments/customer-balance) is sufficient to pay the amount, a [PaymentIntent](/api/payment_intents) with `status` of `succeeded`. * `result.paymentIntent`: when the [Customer Balance](/payments/customer-balance) is insufficient to pay the amount, and `funding_type` data was provided, a [PaymentIntent](/api/payment_intents) with `status` of `requires_action`. * `result.paymentIntent`: when the [Customer Balance](/payments/customer-balance) is insufficient to pay the amount, and no `funding_type` data was provided, a [PaymentIntent](/api/payment_intents) with `status` of `requires_payment_method`. * `result.error`: an error. Refer to the API reference for all possible errors. **Syntax:** `stripe.confirmCustomerBalancePayment(...)` - `clientSecret` (string) **required** The [client secret](/api/payment_intents/object.md#payment_intent_object-client_secret) of the `PaymentIntent`. - `data` (object) Data to be sent with the request. Refer to the [Payment Intents API](/api/payment_intents/confirm.md) for a full list of parameters. - `payment_method` (object) **required** An object specifying the `customer_balance` type. - `customer_balance` (object) **required** Set to `{}`. - `payment_method_options` (object) Additional payment specific configuration options. See the [with collected data](#stripe_confirm_customer_balance_payment-collected) use case below. - `options` (object) An options object to control the behavior of this method. - `handleActions` (boolean) **required** Set to `false`. The [Customer Balance](/payments/customer-balance.md) does not handle the next actions for you automatically (e.g. displaying bank transfer details). To make future upgrades easier, this option is required to always be sent. Please refer to our [Stripe Customer Balance integration guide](/payments/bank-transfers.md) for more info. ### Use case: with collected data You can pass in the customer’s [bank transfer funding](/payments/bank-transfers/accept-a-payment.md) details to create a new `PaymentMethod` and confirm the `PaymentIntent`. If the [Customer Balance](/payments/customer-balance.md) was not enough to pay the amount, the `status` is `requires_action`. The `paymentIntent.next_action.display_bank_transfer_instructions` hash contains bank transfer details for funding the [Customer Balance](/payments/customer-balance.md). ### Data argument properties - `payment_method` (object) **required** Pass an object to confirm using data collected. - `customer_balance` (object) **required** Set to `{}`. - `payment_method_options` (object) Additional payment-specific configuration options. - `funding_type` (string) The funding method type to be used when there are not enough funds in the [Customer Balance](/payments/customer-balance.md). Permitted values include: `bank_transfer`. - `bank_transfer` (object) The customer's chosen bank transfer method. - `type` (string) **required** The list of bank transfer types allowed to use for funding. Permitted values include: `us_bank_account`, `eu_bank_account`, `id_bank_account`, `gb_bank_account`, `jp_bank_account`, or `mx_bank_account`. - `eu_bank_account` (object) Details for the customer's EU bank account transfer. Required if the type is `eu_bank_account`. - `country` (string) **required** The desired country code of the bank account information. Permitted values include: `DE`, `ES`, `FR`, `IE`, `NL`. - `id_bank_account` (object) Details for the customer's Indonesian bank account transfer. Required if the type is `id_bank_account`. - `bank` (string) **required** Bank where the account is held. One of `bca`, `bni`. - `requested_address_types` (array) List of address types that should be returned in the financial_addresses response. If not specified, all valid types will be returned. Permitted values include: `aba`, `swift`, `sort_code`, `zengin`, `iban`, `spei`, `id_bban`, or `sepa`. ### Confirm with collected data ```js stripe.confirmCustomerBalancePayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: { customer_balance: { }, }, payment_method_options: { customer_balance: { funding_type: 'bank_transfer', bank_transfer: { type: 'us_bank_account', }, }, }, }, { handleActions: false, } ).then(function({error, paymentIntent}) { if (error) { // Inform the customer that there was an error. } else if (paymentIntent.status === 'requires_payment_method') { // If `payment_method_options.funding_type` wasn't set this // is where you would need to handle the insufficient customer // balance state. } else if (paymentIntent.status === 'requires_action') { // If the current customer balance is insufficient to cover // the amount, and you've passed // `payment_method_options.funding_type` for funding the // customer balance, you can display the bank transfer // instructions to your user. if (paymentIntent.next_action.type === 'display_bank_transfer_instructions') { // Bank transfer details can be found under: // paymentIntent.next_action.display_bank_transfer_instructions } } }); ``` ```es_next const {paymentIntent, error} = await stripe.confirmCustomerBalancePayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: { customer_balance: { }, }, payment_method_options: { customer_balance: { funding_type: 'bank_transfer', bank_transfer: { type: 'us_bank_account', }, }, }, }, { handleActions: false, } ); if (error) { // Inform the customer that there was an error. } else if (paymentIntent.status === 'requires_payment_method') { // If `payment_method_options.funding_type` wasn't set this // is where you would need to handle the insufficient customer // balance state. } else if (paymentIntent.status === 'requires_action') { // If the current customer balance is insufficient to cover // the amount, and you've passed // `payment_method_options.funding_type` for funding the // customer balance, you can display the bank transfer // instructions to your user. if (paymentIntent.next_action.type === 'display_bank_transfer_instructions') { // Bank transfer details can be found under: // paymentIntent.next_action.display_bank_transfer_instructions } } ``` ### Confirm a Customer Balance payment ```js stripe.confirmCustomerBalancePayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: { customer_balance: {}, } }, { handleActions: false, } ).then(function({error, paymentIntent}) { if (error) { // Inform the customer that there was an error. } else if (paymentIntent.status === 'requires_payment_method') { // If `payment_method_options.funding_type` wasn't set this // is where you would need to handle the insufficient customer // balance state. } else if (paymentIntent.status === 'requires_action') { // If the current customer balance is insufficient to cover // the amount, and you've passed // `payment_method_options.funding_type` for funding the // customer balance, you can display the bank transfer // instructions to your user. if (paymentIntent.next_action.type === 'display_bank_transfer_instructions') { // Bank transfer details can be found under: // paymentIntent.next_action.display_bank_transfer_instructions } } }); ``` ```es_next const {paymentIntent, error} = await stripe.confirmCustomerBalancePayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: { customer_balance: {}, } }, { handleActions: false, } ); if (error) { // Inform the customer that there was an error. } else if (paymentIntent.status === 'requires_payment_method') { // If `payment_method_options.funding_type` wasn't set this // is where you would need to handle the insufficient customer // balance state. } else if (paymentIntent.status === 'requires_action') { // If the current customer balance is insufficient to cover // the amount, and you've passed // `payment_method_options.funding_type` for funding the // customer balance, you can display the bank transfer // instructions to your user. if (paymentIntent.next_action.type === 'display_bank_transfer_instructions') { // Bank transfer details can be found under: // paymentIntent.next_action.display_bank_transfer_instructions } } ``` ## Confirm a Cash App Pay payment Use `stripe.confirmCashappPayment` in the Cash App Pay payment method creation flow when the customer submits your payment form. When called, it will confirm the [PaymentIntent](/api/payment_intents.md) with `data` you provide and handle the [NextAction](/api/payment_intents/object.md#payment_intent_object-next_action) for the customer to authorize the payment. When you confirm a [PaymentIntent](/api/payment_intents.md), it needs to have an attached [PaymentMethod](/api/payment_methods.md). In addition to confirming the `PaymentIntent`, this method can automatically create and attach a new `PaymentMethod` for you. If you have already attached a `PaymentMethod` you can call this method without needing to provide any additional data. These use cases are detailed in the sections that follow. > Note that `stripe.confirmCashappPayment` may take several seconds to complete. > During that time, you should disable your form from being resubmitted and show a waiting indicator like a spinner. > If you receive an error result, you should be sure to show that error to the customer, re-enable the form, and hide the waiting indicator. By default, `stripe.confirmCashappPayment` will display Cash App Pay QR code in desktop web app, or trigger a redirect in mobile web app. If there is an error, or when handling next actions manually by using the `handleActions: false` option, it will return a `Promise` which resolves with a `result` object. This object has either: * `result.paymentIntent`: the successful [PaymentIntent](/api/payment_intents). * `result.error`: an error. Refer to the [API reference](/api/errors) for all possible errors. **Syntax:** `stripe.confirmCashappPayment(...)` - `clientSecret` (string) **required** The [client secret](/api/payment_intents/object.md#payment_intent_object-client_secret) of the `PaymentIntent`. - `data` (object) Data to be sent with the request. Refer to the [Payment Intents API](/api/payment_intents/confirm.md) for a full list of parameters. - `payment_method` (string | object) Either the `id` of an existing [PaymentMethod](/api/payment_methods.md), or an object containing data to create a `PaymentMethod` with. See the use case sections below for details. - `return_url` (string) **required** The url your customer will be directed to after they complete authentication. - `options` (object) An options object to control the behavior of this method. - `handleActions` (boolean) Set this to `false` if you would like to [handle displaying the Cash App Pay QR code or handle the authorization redirect](/payments/cash-app-pay/accept-a-payment?platform=web&ui=API.md#handle-redirect) yourself. ### Use case: Without an existing payment method If you have not already created a `PaymentMethod`, you can pass payment method parameters, and the newly created `PaymentMethod` will be used to confirm the `PaymentIntent`. ### Data argument properties - `return_url` (string) **required** The url your customer will be directed to after they complete authentication. ### Confirm without existing payment method ```js stripe.confirmCashappPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: { type: 'cashapp', }, // Return URL where the customer should be redirected after the authorization. return_url: window.location.href } ).then(function({error, paymentIntent}) { if (error) { // Inform the customer that there was an error. } else if (paymentIntent.status === 'succeeded') { // Inform the customer that the payment was successful } else if (paymentIntent.status === 'requires_action') { // Inform the customer that the payment did not go through } }); ``` ```es_next const {error, paymentIntent} = await stripe.confirmCashappPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: { type: 'cashapp', }, // Return URL where the customer should be redirected after the authorization. return_url: window.location.href } ); if (error) { // Inform the customer that there was an error. } else if (paymentIntent.status === 'succeeded') { // Inform the customer that the payment was successful } else if (paymentIntent.status === 'requires_action') { // Inform the customer that the payment did not go through } ``` ### Use case: With an existing payment method If you have already created a `PaymentMethod`, you can pass its `id` to `payment_method` and it will be used to confirm the `PaymentIntent`. ### Data argument properties - `payment_method` (string) **required** The `id` of an existing `PaymentMethod`. - `return_url` (string) **required** The url your customer will be directed to after they complete authentication. ### Confirm with existing payment method ```js stripe.confirmCashappPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: '{PAYMENT_METHOD_ID}', // Return URL where the customer should be redirected after the authorization. return_url: window.location.href } ).then(function({error, paymentIntent}) { if (error) { // Inform the customer that there was an error. } else if (paymentIntent.status === 'succeeded') { // Inform the customer that the payment was successful } else if (paymentIntent.status === 'requires_action') { // Inform the customer that the payment did not go through } }); ``` ```es_next const {paymentIntent, error} = await stripe.confirmCashappPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: '{PAYMENT_METHOD_ID}', // Return URL where the customer should be redirected after the authorization. return_url: window.location.href } ); if (error) { // Inform the customer that there was an error. } else if (paymentIntent.status === 'succeeded') { // Inform the customer that the payment was successful } else if (paymentIntent.status === 'requires_action') { // Inform the customer that the payment did not go through } ``` ### Use case: With an attached PaymentMethod If you have already attached a `return_url` and a `PaymentMethod` to this `PaymentIntent`, then you can confirm without passing in any additional data. ### Confirm with an attached PaymentMethod ```js stripe.confirmCashappPayment( '{PAYMENT_INTENT_CLIENT_SECRET}' ).then(function({error, paymentIntent}) { if (error) { // Inform the customer that there was an error. } else if (paymentIntent.status === 'succeeded') { // Inform the customer that the payment was successful } else if (paymentIntent.status === 'requires_action') { // Inform the customer that the payment did not go through } }); ``` ```es_next const {error} = await stripe.confirmCashappPayment( '{PAYMENT_INTENT_CLIENT_SECRET}' ); if (error) { // Inform the customer that there was an error. } else if (paymentIntent.status === 'succeeded') { // Inform the customer that the payment was successful } else if (paymentIntent.status === 'requires_action') { // Inform the customer that the payment did not go through } ``` ### Confirm a Cash App Pay payment ```js stripe.confirmCashappPayment( '{PAYMENT_INTENT_CLIENT_SECRET}' ).then(function({error, paymentIntent}) { if (error) { // Inform the customer that there was an error. } else if (paymentIntent.status === 'succeeded') { // Inform the customer that the payment was successful } else if (paymentIntent.status === 'requires_action') { // Inform the customer that the payment did not go through } }); ``` ```es_next const {error} = await stripe.confirmCashappPayment( '{PAYMENT_INTENT_CLIENT_SECRET}' ); if (error) { // Inform the customer that there was an error. } else if (paymentIntent.status === 'succeeded') { // Inform the customer that the payment was successful } else if (paymentIntent.status === 'requires_action') { // Inform the customer that the payment did not go through } ``` ## Confirm an EPS payment Use `stripe.confirmEpsPayment` in the [EPS Payments with Payment Methods](/payments/eps/accept-a-payment.md) flow when the customer submits your payment form. When called, it will confirm the `PaymentIntent` with `data` you provide, and it will automatically redirect the customer to authorize the transaction. Once authorization is complete, the customer will be redirected back to your specified `return_url`. When you confirm a `PaymentIntent`, it needs to have an attached [PaymentMethod](/api/payment_methods.md). In addition to confirming the `PaymentIntent`, this method can automatically create and attach a new `PaymentMethod` for you. If you have already attached a `PaymentMethod` you can call this method without needing to provide any additional data. These use cases are detailed in the sections that follow. > Note that `stripe.confirmEpsPayment` may take several seconds to complete. > During that time, you should disable your form from being resubmitted and show a waiting indicator like a spinner. > If you receive an error result, you should be sure to show that error to the customer, re-enable the form, and hide the waiting indicator. `stripe.confirmEpsPayment` will trigger a redirect when successful. If there is an error, it will return a `Promise` which resolves with a `result` object. This object has either: * `result.paymentIntent`: the successful [PaymentIntent](/api/payment_intents). * `result.error`: an error. Refer to the [API reference](/api/errors) for all possible errors. **Syntax:** `stripe.confirmEpsPayment(...)` - `clientSecret` (string) **required** The [client secret](/api/payment_intents/object.md#payment_intent_object-client_secret) of the `PaymentIntent`. - `data` (object) Data to be sent with the request. Refer to the [Payment Intents API](/api/payment_intents/confirm.md) for a full list of parameters. - `payment_method` (string | object) Either the `id` of an existing [PaymentMethod](/api/payment_methods.md), or an object containing data to create a `PaymentMethod` with. See the use case sections below for details. - `return_url` (string) The url your customer will be directed to after they complete authentication. - `options` (object) An options object to control the behavior of this method. - `handleActions` (boolean) Set this to `false` if you want to [manually handle the authorization redirect](/payments/eps/accept-a-payment?platform=web.md#handle-redirect). Default is `true`. ### Use case: with an existing payment method Use `stripe.confirmEpsPayment` with an existing `PaymentMethod` by passing its `id` to `payment_method`. The `PaymentMethod` will be used to confirm the `PaymentIntent`. ### Data argument properties - `payment_method` (string) **required** The `id` of an existing `PaymentMethod`. - `return_url` (string) The url your customer will be directed to after they complete authentication. ### Confirm with existing payment method ```js stripe .confirmEpsPayment('{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: '{PAYMENT_METHOD_ID}', // Return URL where the customer should be redirected after the authorization. return_url: window.location.href, }) .then(function(result) { // Inform the customer that there was an error. }); ``` ```es_next const {error} = await stripe.confirmEpsPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: '{PAYMENT_METHOD_ID}', // Return URL where the customer should be redirected after the authorization. return_url: window.location.href, }, ); ``` ### Use case: with collected data Your customer's name is required for the EPS authorization to succeed. You can pass in the customer’s name directly to create a new `PaymentMethod` and confirm the `PaymentIntent`. ### Data argument properties - `payment_method` (object) **required** Pass an object to confirm with the customer's name. - `billing_details` (object) **required** An object detailing billing information. - `name` (string) **required** The customer's name. - `return_url` (string) The url your customer will be directed to after they complete authentication. ### Confirm with self collected data ```js stripe .confirmEpsPayment('{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: { billing_details: { name: 'Jenny Rosen', }, }, // Return URL where the customer should be redirected after the authorization. return_url: window.location.href, }) .then(function(result) { if (result.error) { // Inform the customer that there was an error. } }); ``` ```es_next const {error} = await stripe.confirmEpsPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: { billing_details: { name: 'Jenny Rosen', }, }, // Return URL where the customer should be redirected after the authorization. return_url: window.location.href, }, ); ``` ### Use case: with an attached PaymentMethod If you have already attached a `PaymentMethod` to this `PaymentIntent`, then you can confirm the `PaymentIntent` using `stripe.confirmEpsPayment` without passing in any additional data. ### Confirm with an attached PaymentMethod ```js stripe .confirmEpsPayment('{PAYMENT_INTENT_CLIENT_SECRET}') .then(function(result) { // Handle result.error or result.paymentIntent }); ``` ```es_next const {paymentIntent, error} = await stripe.confirmEpsPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', ); ``` ### Confirm an EPS payment ```js stripe .confirmEpsPayment('{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: { billing_details: { name: 'Jenny Rosen', }, }, // Return URL where the customer should be redirected after the authorization. return_url: window.location.href, }) .then(function(result) { if (result.error) { // Inform the customer that there was an error. } }); ``` ```es_next const {error} = await stripe.confirmEpsPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: { billing_details: { name: 'Jenny Rosen', }, }, // Return URL where the customer should be redirected after the authorization. return_url: window.location.href, }, ); ``` ## Confirm an FPX payment Use `stripe.confirmFpxPayment` in the [FPX payment method creation](/stripe-js/elements/fpx-bank.md) flow when the customer submits your payment form. When called, it will confirm the [PaymentIntent](/api/payment_intents.md) with `data` you provide, and it will automatically redirect the customer to authorize the transaction. Once authorization is complete, the customer will be redirected back to your specified `return_url`. When you confirm a `PaymentIntent`, it needs to have an attached [PaymentMethod](/api/payment_methods.md). In addition to confirming the `PaymentIntent`, this method can automatically create and attach a new `PaymentMethod` for you. If you have already attached a `PaymentMethod` you can call this method without needing to provide any additional data. These use cases are detailed in the sections that follow. > Note that `stripe.confirmFpxPayment` may take several seconds to complete. > During that time, you should disable your form from being resubmitted and show a waiting indicator like a spinner. > If you receive an error result, you should be sure to show that error to the customer, re-enable the form, and hide the waiting indicator. By default, `stripe.confirmFpxPayment` will trigger a redirect when successful. If there is an error, or when handling `next_action`s manually by using the `handleActions: false` option, it will return a `Promise` which resolves with a `result` object. This object has either: * `result.paymentIntent`: the successful [PaymentIntent](/api/payment_intents). * `result.error`: an error. Refer to the [API reference](/api/errors) for all possible errors. **Syntax:** `stripe.confirmFpxPayment(...)` - `clientSecret` (string) **required** The [client secret](/api/payment_intents/object.md#payment_intent_object-client_secret) of the `PaymentIntent`. - `data` (object) Data to be sent with the request. Refer to the [Payment Intents API](/api/payment_intents/confirm.md) for a full list of parameters. - `payment_method` (string | object) Either the `id` of an existing [PaymentMethod](/api/payment_methods.md), or an object containing data to create a `PaymentMethod` with. See the use case sections below for details. - `return_url` (string) The url your customer will be directed to after they complete authentication. - `options` (object) An options object to control the behavior of this method. - `handleActions` (boolean) Set this to `false` if you want to [manually handle the authorization redirect](/payments/fpx/accept-a-payment.md#handle-redirect). Default is `true`. ### Use case: with payment data from an Element Create and attach a new PaymentMethod by passing an `fpxBank` [Element](/js/element.md) to `payment_method[fpx]`. The new `PaymentMethod` will be created with the [bank code](/payments/fpx/accept-a-payment.md#bank-reference) collected by the `Element` and will be used to confirm the `PaymentIntent`. ### Data argument properties - `payment_method` (object) **required** Pass an `object` to confirm using data collected by an `fpxBank` [Element](/js/element.md). - `fpx` (Element) An `fpxBank` [Element](/js/element.md). - `return_url` (string) The url your customer will be directed to after they complete authentication. ### Confirm with an Element ```js stripe.confirmFpxPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: { fpx: fpxBankElement }, // Return URL where the customer should be redirected after the authorization. return_url: window.location.href } ).then(function(result) { if (result.error) { // Inform the customer that there was an error. } }); ``` ```es_next const {error} = await stripe.confirmFpxPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: { fpx: fpxBankElement }, // Return URL where the customer should be redirected after the authorization. return_url: window.location.href } ); ``` ### Use case: with an existing payment method If you have already created a `PaymentMethod`, you can pass its `id` to `payment_method` and it will be used to confirm the `PaymentIntent`. ### Data argument properties - `payment_method` (string) **required** The `id` of an existing `PaymentMethod`. - `return_url` (string) The url your customer will be directed to after they complete authentication. ### Confirm with existing payment method ```js stripe.confirmFpxPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: '{PAYMENT_METHOD_ID}', // Return URL where the customer should be redirected after the authorization. return_url: window.location.href } ).then(function(result) { // Inform the customer that there was an error. }); ``` ```es_next const {error} = await stripe.confirmFpxPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: '{PAYMENT_METHOD_ID}', // Return URL where the customer should be redirected after the authorization. return_url: window.location.href } ); ``` ### Use case: with self collected data If you already know the customer’s bank or want to collect it yourself, then you do not need to use the `fpxBank` [Element](/js/element.md). You can pass in the customer’s [bank code](/payments/fpx/accept-a-payment.md#bank-reference) directly. ### Data argument properties - `payment_method` (object) **required** Pass an object to confirm using data collected by an `fpxBank` [Element](/js/element.md). - `fpx` (object) **required** An object detailing the customer's FPX bank. - `bank` (string) **required** The customer's [bank](/payments/fpx/accept-a-payment.md#bank-reference). - `return_url` (string) The url your customer will be directed to after they complete authentication. ### Confirm with self collected data ```js stripe .confirmFpxPayment('{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: { fpx: { bank: 'ambank', }, }, // Return URL where the customer should be redirected after the authorization. return_url: window.location.href, }) .then(function(result) { if (result.error) { // Inform the customer that there was an error. } }); ``` ```es_next const {error} = await stripe.confirmFpxPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: { fpx: { bank: 'ambank', }, }, // Return URL where the customer should be redirected after the authorization. return_url: window.location.href, }, ); ``` ### Use case: with an attached PaymentMethod If you have already attached a `return_url` and a `PaymentMethod` to this `PaymentIntent`, then you can confirm the `PaymentIntent` using `stripe.confirmFpxPayment` without passing in any additional data. ### Confirm with an attached PaymentMethod ```js stripe.confirmFpxPayment( '{PAYMENT_INTENT_CLIENT_SECRET}' ).then(function(result) { if (result.error) { // Inform the customer that there was an error. } }); ``` ```es_next const {error} = await stripe.confirmFpxPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', ); ``` ### Confirm an FPX payment ```js stripe.confirmFpxPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: { fpx: fpxBankElement }, // Return URL where the customer should be redirected after the authorization. return_url: window.location.href } ).then(function(result) { if (result.error) { // Inform the customer that there was an error. } }); ``` ```es_next const {error} = await stripe.confirmFpxPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: { fpx: fpxBankElement }, // Return URL where the customer should be redirected after the authorization. return_url: window.location.href } ); ``` ## Confirm a giropay payment Use `stripe.confirmGiropayPayment` in the [giropay Payments with Payment Methods](/payments/giropay/accept-a-payment.md) flow when the customer submits your payment form. When called, it will confirm the `PaymentIntent` with `data` you provide, and it will automatically redirect the customer to authorize the transaction. Once authorization is complete, the customer will be redirected back to your specified `return_url`. When you confirm a `PaymentIntent`, it needs to have an attached [PaymentMethod](/api/payment_methods.md). In addition to confirming the `PaymentIntent`, this method can automatically create and attach a new `PaymentMethod` for you. If you have already attached a `PaymentMethod` you can call this method without needing to provide any additional data. These use cases are detailed in the sections that follow. > Note that `stripe.confirmGiropayPayment` may take several seconds to complete. > During that time, you should disable your form from being resubmitted and show a waiting indicator like a spinner. > If you receive an error result, you should be sure to show that error to the customer, re-enable the form, and hide the waiting indicator. `stripe.confirmGiropayPayment` will trigger a redirect when successful. If there is an error, it will return a `Promise` which resolves with a `result` object. This object has either: * `result.paymentIntent`: the successful [PaymentIntent](/api/payment_intents). * `result.error`: an error. Refer to the [API reference](/api/errors) for all possible errors. **Syntax:** `stripe.confirmGiropayPayment(...)` - `clientSecret` (string) **required** The [client secret](/api/payment_intents/object.md#payment_intent_object-client_secret) of the `PaymentIntent`. - `data` (object) Data to be sent with the request. Refer to the [Payment Intents API](/api/payment_intents/confirm.md) for a full list of parameters. - `payment_method` (string | object) Either the `id` of an existing [PaymentMethod](/api/payment_methods.md), or an object containing data to create a `PaymentMethod` with. See the use case sections below for details. - `return_url` (string) The url your customer will be directed to after they complete authentication. - `options` (object) An options object to control the behavior of this method. - `handleActions` (boolean) Set this to `false` if you want to [manually handle the authorization redirect](/payments/fpx/accept-a-payment.md#handle-redirect). Default is `true`. ### Use case: with an existing payment method Use `stripe.confirmGiropayPayment` with an existing `PaymentMethod` by passing its `id` to `payment_method`. The `PaymentMethod` will be used to confirm the `PaymentIntent`. ### Data argument properties - `payment_method` (string) **required** The `id` of an existing `PaymentMethod`. - `return_url` (string) The url your customer will be directed to after they complete authentication. ### Confirm with existing payment method ```js stripe .confirmGiropayPayment('{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: '{PAYMENT_METHOD_ID}', // Return URL where the customer should be redirected after the authorization. return_url: window.location.href, }) .then(function(result) { // Inform the customer that there was an error. }); ``` ```es_next const {error} = await stripe.confirmGiropayPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: '{PAYMENT_METHOD_ID}', // Return URL where the customer should be redirected after the authorization. return_url: window.location.href, }, ); ``` ### Use case: with collected data Your customer's name is required for the giropay authorization to succeed. You can pass in the customer’s name directly to create a new `PaymentMethod` and confirm the `PaymentIntent`. ### Data argument properties - `payment_method` (object) **required** Pass an object to confirm with the customer's name. - `billing_details` (object) **required** An object detailing billing information. - `name` (string) **required** The customer's name. - `return_url` (string) The url your customer will be directed to after they complete authentication. ### Confirm with self collected data ```js stripe .confirmGiropayPayment('{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: { billing_details: { name: 'Jenny Rosen', }, }, // Return URL where the customer should be redirected after the authorization. return_url: window.location.href, }) .then(function(result) { if (result.error) { // Inform the customer that there was an error. } }); ``` ```es_next const {error} = await stripe.confirmGiropayPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: { billing_details: { name: 'Jenny Rosen', }, }, // Return URL where the customer should be redirected after the authorization. return_url: window.location.href, }, ); ``` ### Use case: with an attached PaymentMethod If you have already attached a `PaymentMethod` to this `PaymentIntent`, then you can confirm the `PaymentIntent` using `stripe.confirmGiropayPayment` without passing in any additional data. ### Confirm with an attached PaymentMethod ```js stripe .confirmGiropayPayment('{PAYMENT_INTENT_CLIENT_SECRET}') .then(function(result) { // Handle result.error or result.paymentIntent }); ``` ```es_next const {paymentIntent, error} = await stripe.confirmGiropayPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', ); ``` ### Confirm a giropay payment ```js stripe .confirmGiropayPayment('{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: { billing_details: { name: 'Jenny Rosen', }, }, // Return URL where the customer should be redirected after the authorization. return_url: window.location.href, }) .then(function(result) { if (result.error) { // Inform the customer that there was an error. } }); ``` ```es_next const {error} = await stripe.confirmGiropayPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: { billing_details: { name: 'Jenny Rosen', }, }, // Return URL where the customer should be redirected after the authorization. return_url: window.location.href, }, ); ``` ## Confirm a GoPay payment Use `stripe.confirmGoPayPayment` in the [GoPay Payments with Payment Methods](/payments/gopay/accept-a-payment.md) flow when the customer submits your payment form. When called, it will confirm the `PaymentIntent` with `data` you provide, and it will automatically redirect the customer to authorize the transaction. Once authorization is complete, the customer will be redirected back to your specified `return_url`. When you confirm a `PaymentIntent`, it needs to have an attached [PaymentMethod](/api/payment_methods.md). In addition to confirming the `PaymentIntent`, this method can automatically create and attach a new `PaymentMethod` for you. If you have already attached a `PaymentMethod` you can call this method without needing to provide any additional data. These use cases are detailed in the sections that follow. > Note that `stripe.confirmGoPayPayment` may take several seconds to complete. > During that time, you should disable your form from being resubmitted and show a waiting indicator like a spinner. > If you receive an error result, you should be sure to show that error to the customer, re-enable the form, and hide the waiting indicator. `stripe.confirmGoPayPayment` will trigger a redirect when successful. If there is an error, it will return a `Promise` which resolves with a `result` object. This object has either: * `result.paymentIntent`: the successful [PaymentIntent](/api/payment_intents). * `result.error`: an error. Refer to the [API reference](/api/errors) for all possible errors. **Syntax:** `stripe.confirmGoPayPayment(...)` - `clientSecret` (string) **required** The [client secret](/api/payment_intents/object.md#payment_intent_object-client_secret) of the `PaymentIntent`. - `data` (object) Data to be sent with the request. Refer to the [Payment Intents API](/api/payment_intents/confirm.md) for a full list of parameters. - `payment_method` (string | object) Either the `id` of an existing [PaymentMethod](/api/payment_methods.md), or an object containing data to create a `PaymentMethod` with. See the use case sections below for details. - `return_url` (string) The url your customer will be directed to after they complete authentication. - `options` (object) An options object to control the behavior of this method. - `handleActions` (boolean) Set this to `false` if you want to [manually handle the authorization redirect](/payments/gopay/accept-a-payment?platform=web.md#handle-redirect). Default is `true`. ### Use case: with an existing payment method Use `stripe.confirmGoPayPayment` with an existing `PaymentMethod` by passing its `id` to `payment_method`. The `PaymentMethod` will be used to confirm the `PaymentIntent`. ### Data argument properties - `payment_method` (string) **required** The `id` of an existing `PaymentMethod`. - `return_url` (string) The url your customer will be directed to after they complete authentication. ### Confirm with existing payment method ```js stripe .confirmGoPayPayment('{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: '{PAYMENT_METHOD_ID}', // Return URL where the customer should be redirected after the authorization. return_url: window.location.href, }) .then(function(result) { // Inform the customer that there was an error. }); ``` ```es_next const {error} = await stripe.confirmGoPayPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: '{PAYMENT_METHOD_ID}', // Return URL where the customer should be redirected after the authorization. return_url: window.location.href, }, ); ``` ### Use case: with collected data Your customer's name is required for the GoPay authorization to succeed. You can pass in the customer’s name directly to create a new `PaymentMethod` and confirm the `PaymentIntent`. ### Data argument properties - `payment_method` (object) **required** Pass an object to confirm with the customer's name. - `billing_details` (object) **required** An object detailing billing information. - `name` (string) **required** The customer's name. - `return_url` (string) The url your customer will be directed to after they complete authentication. ### Confirm with self collected data ```js stripe .confirmGoPayPayment('{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: { billing_details: { name: 'Jenny Rosen', }, }, // Return URL where the customer should be redirected after the authorization. return_url: window.location.href, }) .then(function(result) { if (result.error) { // Inform the customer that there was an error. } }); ``` ```es_next const {error} = await stripe.confirmGoPayPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: { billing_details: { name: 'Jenny Rosen', }, }, // Return URL where the customer should be redirected after the authorization. return_url: window.location.href, }, ); ``` ### Use case: with an attached PaymentMethod If you have already attached a `PaymentMethod` to this `PaymentIntent`, then you can confirm the `PaymentIntent` using `stripe.confirmGoPayPayment` without passing in any additional data. ### Confirm with an attached PaymentMethod ```js stripe .confirmGoPayPayment('{PAYMENT_INTENT_CLIENT_SECRET}') .then(function(result) { // Handle result.error or result.paymentIntent }); ``` ```es_next const {paymentIntent, error} = await stripe.confirmGoPayPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', ); ``` ### Confirm a GoPay payment ```js stripe .confirmGoPayPayment('{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: { billing_details: { name: 'Jenny Rosen', }, }, // Return URL where the customer should be redirected after the authorization. return_url: window.location.href, }) .then(function(result) { if (result.error) { // Inform the customer that there was an error. } }); ``` ```es_next const {error} = await stripe.confirmGoPayPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: { billing_details: { name: 'Jenny Rosen', }, }, // Return URL where the customer should be redirected after the authorization. return_url: window.location.href, }, ); ``` ## Confirm a GrabPay payment Use `stripe.confirmGrabPayPayment` in the [GrabPay payments with Payment Methods](/payments/grabpay.md) flow when the customer submits your payment form. When called, it will confirm the [PaymentIntent](/api/payment_intents.md), and automatically redirect the customer to authorize the transaction. Once authorization is complete, the customer will be redirected back to your specified `return_url`. > Note that `stripe.confirmGrabPayPayment` may take several seconds to complete. > During that time, you should disable your form from being resubmitted and show a waiting > indicator like a spinner. If you receive an error result, you should be sure to show that > error to the customer, re-enable the form, and hide the waiting indicator. By default, `stripe.confirmGrabPayPayment` will trigger a redirect when successful. If there is an error, or when handling next actions manually by using the `handleActions: false` option, it will return a `Promise` which resolves with a `result` object. This object has either: * `result.paymentIntent`: the successful [PaymentIntent](/api/payment_intents). * `result.error`: an error. Refer to the [API reference](/api/errors) for all possible errors. **Syntax:** `stripe.confirmGrabPayPayment(...)` - `clientSecret` (string) **required** The [client secret](/api/payment_intents/object.md#payment_intent_object-client_secret) of the `PaymentIntent`. - `data` (object) Data to be sent with the request. Refer to the [Payment Intents API](/api/payment_intents/confirm.md) for a full list of parameters. - `payment_method` (string | object) Either the `id` of an existing [PaymentMethod](/api/payment_methods.md), or an object containing data to create a `PaymentMethod` with. See the use case sections below for details. - `return_url` (string) **required** The URL your customer will be directed to after they complete authentication. - `options` (object) An options object to control the behavior of this method. - `handleActions` (boolean) Set this to `false` if you want to [manually handle the authorization redirect](/payments/grabpay.md#handle-redirect). Default is `true`. ### Use case: with a new PaymentMethod You can confirm the `PaymentIntent` using `stripe.confirmGrabPayPayment` without passing in any additional data. This will automatically create and attach a new `PaymentMethod`. ### Data argument properties - `return_url` (string) **required** The URL your customer will be directed to after they complete authentication. ### Confirm with a new PaymentMethod ```js stripe .confirmGrabPayPayment('{PAYMENT_INTENT_CLIENT_SECRET}', { // Return URL where the customer should be redirected after // the authorization. return_url: "https://example.com/checkout/complete", }) .then(function(result) { if (result.error) { // Inform the customer that there was an error. } }); ``` ```es_next const {error} = await stripe.confirmGrabPayPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { // Return URL where the customer should be redirected after // the authorization. return_url: "https://example.com/checkout/complete", }, ); ``` ### Use case: with an existing PaymentMethod Use `stripe.confirmGrabPayPayment` with an existing `PaymentMethod` by passing its `id` to `payment_method`. The `PaymentMethod` will be used to confirm the `PaymentIntent`. ### Data argument properties - `payment_method` (string) **required** The `id` of an existing `PaymentMethod`. - `return_url` (string) **required** The URL your customer will be directed to after they complete authentication. ### Confirm with existing payment method ```js stripe .confirmGrabPayPayment('{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: '{PAYMENT_METHOD_ID}', // Return URL where the customer should be redirected after // the authorization. return_url: "https://example.com/checkout/complete", }) .then(function(result) { if (result.error) { // Inform the customer that there was an error. } }); ``` ```es_next const {error} = await stripe.confirmGrabPayPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: '{PAYMENT_METHOD_ID}', // Return URL where the customer should be redirected after the // authorization. return_url: "https://example.com/checkout/complete", }, ); ``` ### Use case: with an attached PaymentMethod If you have already attached a `PaymentMethod` to this `PaymentIntent`, you can then confirm the `PaymentIntent` using `stripe.confirmGrabPayPayment` without passing in any additional data. ### Data argument properties - `return_url` (string) **required** The URL your customer will be directed to after they complete authentication. ### Confirm with an attached PaymentMethod ```js stripe .confirmGrabPayPayment('{PAYMENT_INTENT_CLIENT_SECRET}', { // Return URL where the customer should be redirected after // the authorization. return_url: "https://example.com/checkout/complete", }) .then(function(result) { if (result.error) { // Inform the customer that there was an error. } }); ``` ```es_next const {error} = await stripe.confirmGrabPayPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { // Return URL where the customer should be redirected after // the authorization. return_url: "https://example.com/checkout/complete", }, ); ``` ### Confirm a GrabPay payment ```js stripe .confirmGrabPayPayment('{PAYMENT_INTENT_CLIENT_SECRET}', { // Return URL where the customer should be redirected after // the authorization. return_url: "https://example.com/checkout/complete", }) .then(function(result) { if (result.error) { // Inform the customer that there was an error. } }); ``` ```es_next const {error} = await stripe.confirmGrabPayPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { // Return URL where the customer should be redirected after // the authorization. return_url: "https://example.com/checkout/complete", }, ); ``` ## Confirm an Indonesia bank transfer payment Use `stripe.confirmIdBankTransferPayment` in the [Indonesia Bank Transfers with Payment Methods](/payments/id-bank-transfer.md) flow when the customer submits your payment form. When called, it will confirm the [PaymentIntent](/api/payment_intents.md) with `data` you provide. Refer to our [integration guide](/payments/id-bank-transfer.md) for more details. When you confirm a `PaymentIntent`, it needs to have an attached [PaymentMethod](/api/payment_methods.md). In addition to confirming the `PaymentIntent`, this method can automatically create and attach a new PaymentMethod for you. If you have already attached a `PaymentMethod` you can call this method without needing to provide any additional data. These use cases are detailed in the sections that follow. > Note that `stripe.confirmIdBankTransferPayment` may take several seconds to complete. > During that time, you should disable your form from being resubmitted and show a waiting indicator like a spinner. > If you receive an error result, you should be sure to show that error to the customer, re-enable the form, and hide the waiting indicator. `stripe.confirmIdBankTransferPayment` will return a `Promise` which resolves with a result object. This object has either: * `result.paymentIntent`: the successful PaymentIntent. * `result.error`: an error. Refer to the API reference for all possible errors. **Syntax:** `stripe.confirmIdBankTransferPayment(...)` - `clientSecret` (string) **required** The [client secret](/api/payment_intents/object.md#payment_intent_object-client_secret) of the `PaymentIntent`. - `data` (object) Data to be sent with the request. Refer to the [Payment Intents API](/api/payment_intents/confirm.md) for a full list of parameters. - `payment_method` (object | string) The `id` of an existing PaymentMethod or an object of collected data. See use cases below for details. ### Use case: with collected data You can pass in the customer’s billing details to create a new `PaymentMethod` and confirm the `PaymentIntent`. ### Data argument properties - `payment_method` (object) **required** Pass an object to confirm using data collected. - `id_bank_transfer` (Object) **required** - `bank` (string) **required** The customer's chosen [bank](/api/payment_methods/create.md#create_payment_method-id_bank_transfer-bank). - `billing_details` (Object) **required** The customer's [billing_details](/api/payment_methods/create.md#create_payment_method-billing_details). `name` is required and `email` is recommended. - `name` (string) **required** The customer's name. - `email` (string) The customer's email. ### Confirm with collected data ```js stripe.confirmIdBankTransferPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: { id_bank_transfer: { bank: 'bni', }, billing_details: { name: 'Fitri Sari', email: 'fitrisari@example.com', }, }, } ).then(function(result) { // Handle result.error or result.paymentIntent }); ``` ```es_next const {paymentIntent, error} = await stripe.confirmIdBankTransferPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: { id_bank_transfer: { bank: 'bni', }, billing_details: { name: 'Fitri Sari', email: 'fitrisari@example.com', }, }, }, ); ``` ### Use case: with an existing payment method If you have already created a `PaymentMethod`, you can pass its `id` to `payment_method` when calling `stripe.confirmIdBankTransferPayment`. It will be used to confirm the `PaymentIntent`. ### Data argument properties - `payment_method` (string) **required** The `id` of an existing [PaymentMethod](/api/payment_methods.md). ### Confirm with existing payment method ```js stripe.confirmIdBankTransferPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: '{PAYMENT_METHOD_ID}', }, { handleActions: false, } ).then(function(result) { // Handle result.error or result.paymentIntent }); ``` ```es_next const {paymentIntent, error} = await stripe.confirmIdBankTransferPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: '{PAYMENT_METHOD_ID}', } ); ``` ### Use case: with an attached PaymentMethod If you have already attached a `PaymentMethod` to this `PaymentIntent`, then you can confirm the `PaymentIntent` using `stripe.confirmIdBankTransferPayment` without passing in any additional data. ### Confirm with an attached PaymentMethod ```js stripe.confirmIdBankTransferPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', {} ).then(function(result) { // Handle result.error or result.paymentIntent }); ``` ```es_next const {paymentIntent, error} = await stripe.confirmIdBankTransferPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', {} ); ``` ### Confirm an Indonesia bank transfer payment ```js stripe.confirmIdBankTransferPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: { id_bank_transfer: { bank: 'bni', }, billing_details: { name: 'Fitri Sari', email: 'fitrisari@example.com', }, }, } ).then(function(result) { // Handle result.error or result.paymentIntent }); ``` ```es_next const {paymentIntent, error} = await stripe.confirmIdBankTransferPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: { id_bank_transfer: { bank: 'bni', }, billing_details: { name: 'Fitri Sari', email: 'fitrisari@example.com', }, }, }, ); ``` ## Confirm an iDEAL payment Use `stripe.confirmIdealPayment` in the [iDEAL Payments with Payment Methods](/payments/ideal.md) flow when the customer submits your payment form. When called, it will confirm the `PaymentIntent` with `data` you provide, and it will automatically redirect the customer to authorize the transaction. Once authorization is complete, the customer will be redirected back to your specified `return_url`. When you confirm a `PaymentIntent`, it needs to have an attached [PaymentMethod](/api/payment_methods.md). In addition to confirming the `PaymentIntent`, this method can automatically create and attach a new `PaymentMethod` for you. If you have already attached a `PaymentMethod` you can call this method without needing to provide any additional data. These use cases are detailed in the sections that follow. > Note that `stripe.confirmIdealPayment` may take several seconds to complete. > During that time, you should disable your form from being resubmitted and show a waiting indicator like a spinner. > If you receive an error result, you should be sure to show that error to the customer, re-enable the form, and hide the waiting indicator. By default, `stripe.confirmIdealPayment` will trigger a redirect when successful. If there is an error, or when handling next actions manually by using the `handleActions: false` option, it will return a `Promise` which resolves with a `result` object. This object has either: * `result.paymentIntent`: the successful [PaymentIntent](/api/payment_intents). * `result.error`: an error. Refer to the [API reference](/api/errors) for all possible errors. **Syntax:** `stripe.confirmIdealPayment(...)` - `clientSecret` (string) **required** The [client secret](/api/payment_intents/object.md#payment_intent_object-client_secret) of the `PaymentIntent`. - `data` (object) Data to be sent with the request. Refer to the [Payment Intents API](/api/payment_intents/confirm.md) for a full list of parameters. - `payment_method` (string | object) Either the `id` of an existing [PaymentMethod](/api/payment_methods.md), or an object containing data to create a `PaymentMethod` with. See the use case sections below for details. - `return_url` (string) The url your customer will be directed to after they complete authentication. - `setup_future_usage` (string) To set up a SEPA Direct Debit payment method using the bank details from this iDEAL payment, set this parameter to `off_session`. When using this parameter, a `customer` will need to be set on the [PaymentIntent](/api/payment_intents.md). The newly created SEPA Direct Debit [PaymentMethod](/api/payment_methods.md) will be attached to this customer. - `options` (object) An options object to control the behavior of this method. - `handleActions` (boolean) Set this to `false` if you want to [manually handle the authorization redirect](/payments/ideal/accept-a-payment?platform=web.md#web-handle-redirect). Default is `true`. ### Use case: with payment data from an Element Create and attach a new `PaymentMethod` with `stripe.confirmIdealPayment` by passing an `idealBank` [Element](/js/element.md) to `payment_method[ideal]`. The new `PaymentMethod` will be created with the [bank code](/payments/ideal/accept-a-payment?platform=web&ui=element.md#bank-reference) collected by the `Element` and will be used to confirm the `PaymentIntent`. ### Data argument properties - `payment_method` (object) **required** Pass an object to confirm using data collected by an `idealBank` [Element](/js/element.md). - `ideal` (Element) An `idealBank` [Element](/js/element.md). - `billing_details` (object) The customer's [billing_details](/api/payment_methods/create.md#create_payment_method-billing_details). Required when `setup_future_usage` is set to `off_session`. - `name` (string) The customer's name. - `email` (string) The customer's email. - `return_url` (string) The url your customer will be directed to after they complete authentication. - `setup_future_usage` (string) To set up a SEPA Direct Debit payment method using the bank details from this iDEAL payment, set this parameter to `off_session`. When using this parameter, a `customer` will need to be set on the [PaymentIntent](/api/payment_intents.md). The newly created SEPA Direct Debit [PaymentMethod](/api/payment_methods.md) will be attached to this customer. ### Confirm with an Element ```js stripe .confirmIdealPayment('{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: { ideal: idealBankElement, }, // Return URL where the customer should be redirected after the authorization. return_url: window.location.href, }) .then(function(result) { if (result.error) { // Inform the customer that there was an error. } }); ``` ```es_next const {error} = await stripe.confirmIdealPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: { ideal: idealBankElement, }, // Return URL where the customer should be redirected after the authorization. return_url: window.location.href, }, ); ``` ### Use case: with an existing payment method Use `stripe.confirmIdealPayment` with an existing `PaymentMethod` by passing its `id` to `payment_method`. The `PaymentMethod` will be used to confirm the `PaymentIntent`. ### Data argument properties - `payment_method` (string) **required** The `id` of an existing `PaymentMethod`. - `return_url` (string) The url your customer will be directed to after they complete authentication. - `setup_future_usage` (string) To set up a SEPA Direct Debit payment method using the bank details from this iDEAL payment, set this parameter to `off_session`. When using this parameter, a `customer` will need to be set on the [PaymentIntent](/api/payment_intents.md). The newly created SEPA Direct Debit [PaymentMethod](/api/payment_methods.md) will be attached to this customer. ### Confirm with existing payment method ```js stripe .confirmIdealPayment('{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: '{PAYMENT_METHOD_ID}', // Return URL where the customer should be redirected after the authorization. return_url: window.location.href, }) .then(function(result) { // Inform the customer that there was an error. }); ``` ```es_next const {error} = await stripe.confirmIdealPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: '{PAYMENT_METHOD_ID}', // Return URL where the customer should be redirected after the authorization. return_url: window.location.href, }, ); ``` ### Use case: with self collected data If you already know the customer’s bank or want to collect it yourself, then you do not need to use the `idealBank` [Element](/js/element.md). You can pass in the customer’s [bank code](/payments/ideal/accept-a-payment?platform=web&ui=element.md#bank-reference) directly to create a new `PaymentMethod` and confirm the `PaymentIntent`. ### Data argument properties - `payment_method` (object) **required** Pass an object to confirm using data collected by an `idealBank` [Element](/js/element.md). - `ideal` (object) **required** An object detailing the customer's iDEAL bank. - `bank` (string) **required** The customer's [bank](/payments/ideal/accept-a-payment?platform=web&ui=element.md#bank-reference). - `billing_details` (object) The customer's [billing_details](/api/payment_methods/create.md#create_payment_method-billing_details). Required when `setup_future_usage` is set to `off_session`. - `name` (string) The customer's name. - `email` (string) The customer's email. - `return_url` (string) The url your customer will be directed to after they complete authentication. - `setup_future_usage` (string) To set up a SEPA Direct Debit payment method using the bank details from this iDEAL payment, set this parameter to `off_session`. When using this parameter, a `customer` will need to be set on the [PaymentIntent](/api/payment_intents.md). The newly created SEPA Direct Debit [PaymentMethod](/api/payment_methods.md) will be attached to this customer. ### Confirm with self collected data ```js stripe .confirmIdealPayment('{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: { ideal: { bank: 'abn_amro', }, }, // Return URL where the customer should be redirected after the authorization. return_url: window.location.href, }) .then(function(result) { if (result.error) { // Inform the customer that there was an error. } }); ``` ```es_next const {error} = await stripe.confirmIdealPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: { ideal: { bank: 'abn_amro', }, }, // Return URL where the customer should be redirected after the authorization. return_url: window.location.href, }, ); ``` ### Use case: with an attached PaymentMethod If you have already attached a `PaymentMethod` to this `PaymentIntent`, then you can confirm the `PaymentIntent` using `stripe.confirmIdealPayment` without passing in any additional data. ### Confirm with an attached PaymentMethod ```js stripe .confirmIdealPayment('{PAYMENT_INTENT_CLIENT_SECRET}') .then(function(result) { // Handle result.error or result.paymentIntent }); ``` ```es_next const {paymentIntent, error} = await stripe.confirmIdealPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', ); ``` ### Confirm an iDEAL payment ```js stripe .confirmIdealPayment('{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: { ideal: idealBankElement, }, // Return URL where the customer should be redirected after the authorization. return_url: window.location.href, }) .then(function(result) { if (result.error) { // Inform the customer that there was an error. } }); ``` ```es_next const {error} = await stripe.confirmIdealPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: { ideal: idealBankElement, }, // Return URL where the customer should be redirected after the authorization. return_url: window.location.href, }, ); ``` ## Confirm a Klarna payment Use `stripe.confirmKlarnaPayment` in the Klarna payment method creation flow when the customer submits your payment form. When called, it will confirm the [PaymentIntent](/api/payment_intents.md) with `data` you provide, and it will automatically redirect the customer to authorize the transaction. Once authorization is complete, the customer will be redirected back to your specified `return_url`. When you confirm a `PaymentIntent`, it needs to have an attached [PaymentMethod](/api/payment_methods.md). In addition to confirming the `PaymentIntent`, this method can automatically create and attach a new `PaymentMethod` for you. If you have already attached a `PaymentMethod` you can call this method without needing to provide any additional data. These use cases are detailed in the sections that follow. > Note that `stripe.confirmKlarnaPayment` may take several seconds to complete. > During that time, you should disable your form from being resubmitted and show a waiting indicator like a spinner. > If you receive an error result, you should be sure to show that error to the customer, re-enable the form, and hide the waiting indicator. By default, `stripe.confirmKlarnaPayment` will trigger a redirect when successful. If there is an error, or when handling `next_action`s manually by using the `handleActions: false` option, it will return a `Promise` which resolves with a `result` object. This object has either: * `result.paymentIntent`: the successful [PaymentIntent](/api/payment_intents). * `result.error`: an error. Refer to the [API reference](/api/errors) for all possible errors. **Syntax:** `stripe.confirmKlarnaPayment(...)` - `clientSecret` (string) **required** The [client secret](/api/payment_intents/object.md#payment_intent_object-client_secret) of the `PaymentIntent`. - `data` (object) Data to be sent with the request. Refer to the [Payment Intents API](/api/payment_intents/confirm.md) for a full list of parameters. - `payment_method` (string | object) Either the `id` of an existing [PaymentMethod](/api/payment_methods.md), or an object containing data to create a `PaymentMethod` with. See the use case sections below for details. - `return_url` (string) The url your customer will be directed to after they complete authentication. - `options` (object) An options object to control the behavior of this method. - `handleActions` (boolean) Set this to `false` if you want to [manually handle the authorization redirect](/payments/klarna/accept-a-payment.md#handle-redirect). Default is `true`. ### Use case: Without an existing payment method If you have not already created a `PaymentMethod`, the newly created `PaymentMethod` will be used to confirm the `PaymentIntent`. ### Data argument properties - `return_url` (string) The url your customer will be directed to after they complete authentication. ### Confirm without existing payment method ```js stripe.confirmKlarnaPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: { billing_details: { address: { country: 'DE', }, }, }, // Return URL where the customer should be redirected after the authorization. return_url: window.location.href } ).then(function(result) { if (result.error) { // Inform the customer that there was an error. } }); ``` ```es_next const {error} = await stripe.confirmKlarnaPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: { billing_details: { address: { country: 'DE', }, }, }, // Return URL where the customer should be redirected after the authorization. return_url: window.location.href } ); ``` ### Use case: With an existing payment method If you have already created a `PaymentMethod`, you can pass its `id` to `payment_method` and it will be used to confirm the `PaymentIntent`. ### Data argument properties - `payment_method` (string) **required** The `id` of an existing `PaymentMethod`. - `return_url` (string) The url your customer will be directed to after they complete authentication. ### Confirm with existing payment method ```js stripe.confirmKlarnaPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: '{PAYMENT_METHOD_ID}', // Return URL where the customer should be redirected after the authorization. return_url: window.location.href } ).then(function(result) { // Inform the customer that there was an error. }); ``` ```es_next const {error} = await stripe.confirmKlarnaPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: '{PAYMENT_METHOD_ID}', // Return URL where the customer should be redirected after the authorization. return_url: window.location.href } ); ``` ### Use case: With an attached PaymentMethod If you have already attached a `return_url` and a `PaymentMethod` to this `PaymentIntent`, then you can confirm without passing in any additional data. ### Confirm with an attached PaymentMethod ```js stripe.confirmKlarnaPayment( '{PAYMENT_INTENT_CLIENT_SECRET}' ).then(function(result) { if (result.error) { // Inform the customer that there was an error. } }); ``` ```es_next const {error} = await stripe.confirmKlarnaPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', ); ``` ### Confirm a Klarna payment ```js stripe.confirmKlarnaPayment( '{PAYMENT_INTENT_CLIENT_SECRET}' ).then(function(result) { if (result.error) { // Inform the customer that there was an error. } }); ``` ```es_next const {error} = await stripe.confirmKlarnaPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', ); ``` ## Confirm a Konbini payment Use `stripe.confirmKonbiniPayment` in the [Konbini](/payments/konbini.md) payment flow when the customer submits your payment form. When called, it will confirm the [PaymentIntent](/api/payment_intents.md) with `data` you provide. Note that there are some additional requirements to this flow that are not covered in this reference. Refer to our [integration guide](/payments/konbini/accept-a-payment.md) for more details. When you confirm a `PaymentIntent`, it needs to have an attached [PaymentMethod](/api/payment_methods.md). In addition to confirming the `PaymentIntent`, this method can automatically create and attach a new PaymentMethod for you. If you have already attached a `PaymentMethod` you can call this method without needing to provide any additional data. These use cases are detailed in the sections that follow. > Note that `stripe.confirmKonbiniPayment` may take several seconds to complete. > During that time, you should disable your form from being resubmitted and show a waiting indicator like a spinner. > If you receive an error result, you should be sure to show that error to the customer, re-enable the form, and hide the waiting indicator. `stripe.confirmKonbiniPayment` will return a `Promise` which resolves with a result object. This object has either: * `result.paymentIntent`: the successful PaymentIntent. * `result.error`: an error. Refer to the API reference for all possible errors. **Syntax:** `stripe.confirmKonbiniPayment(...)` - `clientSecret` (string) **required** The [client secret](/api/payment_intents/object.md#payment_intent_object-client_secret) of the `PaymentIntent`. - `data` (object) Data to be sent with the request. Refer to the [Payment Intents API](/api/payment_intents/confirm.md) for a full list of parameters. - `payment_method` (object | string) Either the `id` of an existing [PaymentMethod](/api/payment_methods.md), or an object containing data to create a `PaymentMethod` with. See the use case sections below for details. - `payment_method_options` (Object) An object containing payment-method-specific configuration to confirm the [PaymentIntent](/api/payment_intents.md) with. - `konbini` (object) Configuration for this Konbini payment. - `confirmation_number` (string) An optional 10 to 11 digit numeric-only string determining the confirmation code at applicable convenience stores. May not be all 0 and could be rejected in case of insufficient uniqueness. We recommend to use the customer’s phone number. - `options` (object) An options object to control the behavior of this method. - `handleActions` (boolean) Set this to `false` if you want to handle next actions yourself. Please refer to our [integration guide](/payments/konbini/accept-a-payment.md) for more info. Default is `true`. ### Use case: with collected data You can pass in the customer’s billing details to create a new `PaymentMethod` and confirm the `PaymentIntent`. To create a Konbini `PaymentMethod`, you are required to collect and include the customer’s name and email. ### Data argument properties - `payment_method` (object) **required** Pass an object to confirm using data collected. - `billing_details` (Object) **required** The customer's [billing_details](/api/payment_methods/create.md#create_payment_method-billing_details). - `name` (string) **required** The customer's full name. - `email` (string) **required** The customer's email address. - `payment_method_options` (Object) An object containing payment-method-specific configuration to confirm the [PaymentIntent](/api/payment_intents.md) with. - `konbini` (object) Configuration for this Konbini payment. - `confirmation_number` (string) An optional 10 to 11 digit numeric-only string determining the confirmation code at applicable convenience stores. May not be all 0 and could be rejected in case of insufficient uniqueness. We recommend to use the customer’s phone number. ### Confirm with collected data ```js stripe.confirmKonbiniPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: { billing_details: { name: '花子山田', email: 'yamada.hanako@example.com', }, }, payment_method_options: { konbini: { confirmation_number: '08012341234', }, }, } ).then(function(result) { // Handle result.error or result.paymentIntent }); ``` ```es_next const {paymentIntent, error} = await stripe.confirmKonbiniPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: { billing_details: { name: '花子山田', email: 'yamada.hanako@example.com', }, }, payment_method_options: { konbini: { confirmation_number: '08012341234', }, }, } ); ``` ### Use case: with an existing payment method If you have already created a `PaymentMethod`, you can pass its `id` to `payment_method` when calling `stripe.confirmKonbiniPayment`. It will be used to confirm the `PaymentIntent`. ### Data argument properties - `payment_method` (string) **required** The `id` of an existing [PaymentMethod](/api/payment_methods.md). - `payment_method_options` (Object) An object containing payment-method-specific configuration to confirm the [PaymentIntent](/api/payment_intents.md) with. - `konbini` (object) Configuration for this Konbini payment. - `confirmation_number` (string) An optional 10 to 11 digit numeric-only string determining the confirmation code at applicable convenience stores. May not be all 0 and could be rejected in case of insufficient uniqueness. We recommend to use the customer’s phone number. ### Confirm with existing payment method ```js stripe.confirmKonbiniPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: '{PAYMENT_METHOD_ID}', payment_method_options: { konbini: { confirmation_number: '08012341234', }, }, }, ).then(function(result) { // Handle result.error or result.paymentIntent }); ``` ```es_next const {paymentIntent, error} = await stripe.confirmKonbiniPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: '{PAYMENT_METHOD_ID}', payment_method_options: { konbini: { confirmation_number: '08012341234', }, }, } ); ``` ### Use case: with an attached PaymentMethod If you have already attached a `PaymentMethod` to this `PaymentIntent`, then you can confirm the `PaymentIntent` using `stripe.confirmKonbiniPayment` without passing in any additional data. ### Data argument properties - `payment_method_options` (Object) An object containing payment-method-specific configuration to confirm the [PaymentIntent](/api/payment_intents.md) with. - `konbini` (object) Configuration for this Konbini payment. - `confirmation_number` (string) An optional 10 to 11 digit numeric-only string determining the confirmation code at applicable convenience stores. May not be all 0 and could be rejected in case of insufficient uniqueness. We recommend to use the customer’s phone number. ### Confirm with an attached PaymentMethod ```js stripe.confirmKonbiniPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method_options: { konbini: { confirmation_number: '08012341234', }, }, } ).then(function(result) { // Handle result.error or result.paymentIntent }); ``` ```es_next const {paymentIntent, error} = await stripe.confirmKonbiniPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method_options: { konbini: { confirmation_number: '08012341234', }, }, } ); ``` ### Confirm a Konbini payment ```js stripe.confirmKonbiniPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: { billing_details: { name: '花子山田', email: 'yamada.hanako@example.com', }, }, payment_method_options: { konbini: { confirmation_number: '08012341234', }, }, } ).then(function(result) { // Handle result.error or result.paymentIntent }); ``` ```es_next const {paymentIntent, error} = await stripe.confirmKonbiniPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: { billing_details: { name: '花子山田', email: 'yamada.hanako@example.com', }, }, payment_method_options: { konbini: { confirmation_number: '08012341234', }, }, } ); ``` ## Confirm a MB WAY payment Use `stripe.confirmMbWayPayment` in the MB WAY payment method creation flow when the customer submits your payment form. When you call the method, it confirms the [PaymentIntent](/api/payment_intents.md) with the `data` you provide, and sends a request to the customer to authorize the transaction. When you confirm a `PaymentIntent`, it needs to have an attached [PaymentMethod](/api/payment_methods.md). In addition to confirming the `PaymentIntent`, this method can automatically create and attach a new `PaymentMethod` for you. If you've already attached a `PaymentMethod`, you can call this method without needing to provide any additional data. These use cases are detailed in the sections that follow. > Note that `stripe.confirmMbWayPayment` might take some time to complete while waiting for customers to authorize the payment. > During that time, you should disable your form from being resubmitted and show a waiting indicator like a spinner. > If you receive an error result, show that error to the customer, re-enable the form, and hide the waiting indicator. By default, `stripe.confirmMbWayPayment` will poll for updates to the `PaymentIntent`. If there's an error, or when handling `next_action`s manually by using the `handleActions: false` option, it returns a `Promise` which resolves with a `result` object. This object has either: * `result.paymentIntent`: the successful [PaymentIntent](/api/payment_intents). * `result.error`: an error. Refer to the [API reference](/api/errors) for all possible errors. **Syntax:** `stripe.confirmMbWayPayment(...)` - `clientSecret` (string) **required** The [client secret](/api/payment_intents/object.md#payment_intent_object-client_secret) of the `PaymentIntent`. - `data` (object) Data to be sent with the request. Refer to the [Payment Intents API](/api/payment_intents/confirm.md) for a full list of parameters. - `payment_method` (string | object) Either the `id` of an existing [PaymentMethod](/api/payment_methods.md), or an object containing data to create a `PaymentMethod` with. See the use case sections below for details. - `options` (object) An options object to control the behavior of this method. - `handleActions` (boolean) Set this to `false` if you want to manually handle polling for PaymentIntent updates. Default is `true`. ### Use case: without an existing payment method If you haven't already created a `PaymentMethod`, you can pass payment method parameters, and the newly created `PaymentMethod` is used to confirm the `PaymentIntent`. ### Data argument properties - `payment_method` (object) **required** Pass payment method billing details. - `billing_details` (object) **required** The [billing_details](/api/payment_methods/create.md#create_payment_method-billing_details) associated with the payment. A phone number is required for all MB WAY payments. - `phone` (string) **required** ### Confirm without existing payment method ```js stripe.confirmMbWayPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: { billing_details: { phone: '+351911111111' } } } ).then(function(result) { if (result.error) { // Inform the customer that there was an error. } }); ``` ```es_next const {paymentIntent, error} = await stripe.confirmMbWayPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: { billing_details: { phone: '+351911111111' } } } ); ``` ### Use case: with an existing payment method If you've already created a `PaymentMethod`, you can pass its `id` to `payment_method`, which is used to confirm the `PaymentIntent`. ### Data argument properties - `payment_method` (string) **required** The `id` of an existing `PaymentMethod`. ### Confirm with existing payment method ```js stripe.confirmMbWayPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: '{PAYMENT_METHOD_ID}' } ).then(function(result) { // Inform the customer that there was an error. }); ``` ```es_next const {paymentIntent, error} = await stripe.confirmMbWayPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: '{PAYMENT_METHOD_ID}' } ); ``` ### Use case: with an attached PaymentMethod If you've already attached a `PaymentMethod` to this `PaymentIntent`, you can confirm it without passing in any additional data. ### Confirm with an attached PaymentMethod ```js stripe .confirmMbWayPayment('{PAYMENT_INTENT_CLIENT_SECRET}') .then(function(result) { if (result.error) { // Inform the customer that there was an error. } }); ``` ```es_next const {paymentIntent, error} = await stripe.confirmMbWayPayment('{PAYMENT_INTENT_CLIENT_SECRET}'); ``` ### Confirm a MB WAY payment ```js stripe .confirmMbWayPayment('{PAYMENT_INTENT_CLIENT_SECRET}') .then(function(result) { if (result.error) { // Inform the customer that there was an error. } }); ``` ```es_next const {paymentIntent, error} = await stripe.confirmMbWayPayment('{PAYMENT_INTENT_CLIENT_SECRET}'); ``` ## Confirm a MobilePay payment Use `stripe.confirmMobilepayPayment` in the [MobilePay Payments with Payment Methods](/payments/mobilepay.md) flow when the customer submits your payment form. When called, it will confirm the `PaymentIntent` with `data` you provide, and it will automatically redirect the customer to authorize the transaction. Once authorization is complete, the customer will be redirected back to your specified `return_url`. When you confirm a `PaymentIntent`, it needs to have an attached [PaymentMethod](/api/payment_methods.md). In addition to confirming the `PaymentIntent`, this method can automatically create and attach a new `PaymentMethod` for you. If you have already attached a `PaymentMethod` you can call this method without needing to provide any additional data. These use cases are detailed in the sections that follow. > Note that `stripe.confirmMobilepayPayment` may take several seconds to complete. > During that time, you should disable your form from being resubmitted and show a waiting indicator like a spinner. > If you receive an error result, you should be sure to show that error to the customer, re-enable the form, and hide the waiting indicator. By default, `stripe.confirmMobilepayPayment` will trigger a redirect when successful. If there is an error, or when handling next actions manually by using the `handleActions: false` option, it will return a `Promise` which resolves with a `result` object. This object has either: * `result.paymentIntent`: the successful [PaymentIntent](/api/payment_intents). * `result.error`: an error. Refer to the [API reference](/api/errors) for all possible errors. **Syntax:** `stripe.confirmMobilepayPayment(...)` - `clientSecret` (string) **required** The [client secret](/api/payment_intents/object.md#payment_intent_object-client_secret) of the `PaymentIntent`. - `data` (object) Data to be sent with the request. Refer to the [Payment Intents API](/api/payment_intents/confirm.md) for a full list of parameters. - `payment_method` (string | object) Either the `id` of an existing [PaymentMethod](/api/payment_methods.md), or an object containing data to create a `PaymentMethod` with. See the use case sections below for details. - `return_url` (string) The url your customer will be directed to after they complete authentication. - `options` (object) An options object to control the behavior of this method. - `handleActions` (boolean) Set this to `false` if you want to [manually handle the authorization redirect](/payments/ideal/accept-a-payment?platform=web.md#web-handle-redirect). Default is `true`. ### Use case: with an existing payment method Use `stripe.confirmMobilepayPayment` with an existing `PaymentMethod` by passing its `id` to `payment_method`. The `PaymentMethod` will be used to confirm the `PaymentIntent`. ### Data argument properties - `payment_method` (string) **required** The `id` of an existing `PaymentMethod`. - `return_url` (string) The url your customer will be directed to after they complete authentication. ### Confirm with existing payment method ```js stripe .confirmMobilepayPayment('{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: '{PAYMENT_METHOD_ID}', // Return URL where the customer should be redirected after the authorization. return_url: window.location.href, }) .then(function(result) { // Inform the customer that there was an error. }); ``` ```es_next const {error} = await stripe.confirmMobilepayPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: '{PAYMENT_METHOD_ID}', // Return URL where the customer should be redirected after the authorization. return_url: window.location.href, }, ); ``` ### Use case: with an attached PaymentMethod If you have already attached a `PaymentMethod` to this `PaymentIntent`, then you can confirm the `PaymentIntent` using `stripe.confirmMobilepayPayment` without passing in any additional data. ### Confirm with an attached PaymentMethod ```js stripe .confirmMobilepayPayment('{PAYMENT_INTENT_CLIENT_SECRET}') .then(function(result) { // Handle result.error or result.paymentIntent }); ``` ```es_next const {paymentIntent, error} = await stripe.confirmMobilepayPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', ); ``` ### Confirm a MobilePay payment ```js stripe .confirmMobilepayPayment('{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: { mobilepay: {}, } // Return URL where the customer should be redirected after the authorization. return_url: window.location.href, }) .then(function(result) { if (result.error) { // Inform the customer that there was an error. } }); ``` ```es_next const {error} = await stripe.confirmMobilepayPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { // Return URL where the customer should be redirected after the authorization. return_url: window.location.href, }, ); ``` ## Confirm a Multibanco payment Use `stripe.confirmMultibancoPayment` in the [Multibanco Payment](/payments/multibanco.md) with Payment Methods flow when the customer submits your payment form. When called, it will confirm the [PaymentIntent](/api/payment_intents.md) with `data` you provide. Note that there are some additional requirements to this flow that are not covered in this reference. Refer to our [integration guide](/payments/multibanco/accept-a-payment.md) for more details. When you confirm a `PaymentIntent`, it needs to have an attached [PaymentMethod](/api/payment_methods.md). In addition to confirming the `PaymentIntent`, this method can automatically create and attach a new PaymentMethod for you. If you have already attached a `PaymentMethod` you can call this method without needing to provide any additional data. These use cases are detailed in the sections that follow. > `stripe.confirmMultibancoPayment` might take several seconds to complete. During that time, disable your form from being resubmitted and show a > waiting indicator, such as a spinner. If you receive an error, display it to the customer, re-enable the form, and hide the waiting indicator. > > Additionally, `stripe.confirmMultibancoPayment` will pop up a modal with the voucher. This modal contains all the information required > to pay the voucher through online banking or from an ATM, such as the Multibanco entity and reference numbers, and amount. `stripe.confirmMultibancoPayment` will return a `Promise` which resolves with a result object. This object has either: * `result.paymentIntent`: the successful PaymentIntent. * `result.error`: an error. Refer to the API reference for all possible errors. **Syntax:** `stripe.confirmMultibancoPayment(...)` - `clientSecret` (string) **required** The [client secret](/api/payment_intents/object.md#payment_intent_object-client_secret) of the `PaymentIntent`. - `data` (object) Data to be sent with the request. Refer to the [Payment Intents API](/api/payment_intents/confirm.md) for a full list of parameters. - `payment_method` (object | string) The `id` of an existing PaymentMethod or an object of collected data. See use cases below for details. - `options` (object) An options object to control the behavior of this method. - `handleActions` (boolean) Set this to `false` if you want to handle next actions yourself. Please refer to our [Stripe Multibanco integration guide](/payments/multibanco/accept-a-payment.md) for more info. Default is `true`. ### Use case: with collected data You can pass in the customer’s billing details to create a new `PaymentMethod` and confirm the `PaymentIntent`. To create a Multibanco `PaymentMethod`, you are required to collect and include the customer’s email address. ### Data argument properties - `payment_method` (object) **required** Pass an object to confirm using data collected. - `billing_details` (Object) **required** The customer's [billing_details](/api/payment_methods/create.md#create_payment_method-billing_details). `email` is required. - `email` (string) **required** The customer's email. ### Confirm with collected data ```js stripe.confirmMultibancoPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: { billing_details: { email: 'jenny@example.com', }, }, } ).then(function(result) { // Handle result.error or result.paymentIntent }); ``` ```es_next const {paymentIntent, error} = await stripe.confirmMultibancoPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: { billing_details: { email: 'jenny@example.com', }, }, } ); ``` ### Use case: with an existing payment method If you have already created a `PaymentMethod`, you can pass its `id` to `payment_method` when calling `stripe.confirmMultibancoPayment`. It will be used to confirm the `PaymentIntent`. ### Data argument properties - `payment_method` (string) **required** The `id` of an existing [PaymentMethod](/api/payment_methods.md). ### Confirm with existing payment method ```js stripe.confirmMultibancoPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: '{PAYMENT_METHOD_ID}', } ).then(function(result) { // Handle result.error or result.paymentIntent }); ``` ```es_next const {paymentIntent, error} = await stripe.confirmMultibancoPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: '{PAYMENT_METHOD_ID}', } ); ``` ### Use case: with an attached PaymentMethod If you have already attached a `PaymentMethod` to this `PaymentIntent`, then you can confirm the `PaymentIntent` using `stripe.confirmMultibancoPayment` without passing in any additional data. ### Confirm with an attached PaymentMethod ```js stripe.confirmMultibancoPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', {} ).then(function(result) { // Handle result.error or result.paymentIntent }); ``` ```es_next const {paymentIntent, error} = await stripe.confirmMultibancoPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', {} ); ``` ### Confirm a Multibanco payment ```js stripe.confirmMultibancoPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: { billing_details: { email: 'jenny@example.com', }, }, } ).then(function(result) { // Handle result.error or result.paymentIntent }); ``` ```es_next const {paymentIntent, error} = await stripe.confirmMultibancoPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: { billing_details: { email: 'jenny@example.com', }, }, } ); ``` ## Confirm an Oxxo payment Use `stripe.confirmOxxoPayment` in the [OXXO Payment](/payments/oxxo.md) with Payment Methods flow when the customer submits your payment form. When called, it will confirm the [PaymentIntent](/api/payment_intents.md) with `data` you provide. Note that there are some additional requirements to this flow that are not covered in this reference. Refer to our [integration guide](/payments/oxxo.md) for more details. When you confirm a `PaymentIntent`, it needs to have an attached [PaymentMethod](/api/payment_methods.md). In addition to confirming the `PaymentIntent`, this method can automatically create and attach a new PaymentMethod for you. If you have already attached a `PaymentMethod` you can call this method without needing to provide any additional data. These use cases are detailed in the sections that follow. > Note that `stripe.confirmOxxoPayment` may take several seconds to complete. > During that time, you should disable your form from being resubmitted and show a waiting indicator like a spinner. > If you receive an error result, you should be sure to show that error to the customer, re-enable the form, and hide the waiting indicator. > > Additionally, `stripe.confirmOxxoPayment` will pop up a modal with the voucher. This modal contains all the information required > to pay the voucher at OXXO stores, such as the amount, a reference number and corresponding barcode. `stripe.confirmOxxoPayment` will return a `Promise` which resolves with a result object. This object has either: * `result.paymentIntent`: the successful PaymentIntent. * `result.error`: an error. Refer to the API reference for all possible errors. **Syntax:** `stripe.confirmOxxoPayment(...)` - `clientSecret` (string) **required** The [client secret](/api/payment_intents/object.md#payment_intent_object-client_secret) of the `PaymentIntent`. - `data` (object) Data to be sent with the request. Refer to the [Payment Intents API](/api/payment_intents/confirm.md) for a full list of parameters. - `payment_method` (object | string) The `id` of an existing PaymentMethod or an object of collected data. See use cases below for details. - `options` (object) An options object to control the behavior of this method. - `handleActions` (boolean) Set this to `false` if you want to handle next actions yourself. Please refer to our [Stripe OXXO integration guide](/payments/oxxo.md) for more info. Default is `true`. ### Use case: with collected data You can pass in the customer’s billing details to create a new `PaymentMethod` and confirm the `PaymentIntent`. To create a OXXO `PaymentMethod`, you are required to collect and include the customer’s name and email address. ### Data argument properties - `payment_method` (object) **required** Pass an object to confirm using data collected. - `billing_details` (Object) **required** The customer's [billing_details](/api/payment_methods/create.md#create_payment_method-billing_details). `name` and `email` are required. - `name` (string) **required** The customer's name. The first and last name must be at minimum 2 characters each. - `email` (string) **required** The customer's email. ### Confirm with collected data ```js stripe.confirmOxxoPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: { billing_details: { name: 'Fulano de Tal', email: 'fulano@example.com', }, }, } ).then(function(result) { // Handle result.error or result.paymentIntent }); ``` ```es_next const {paymentIntent, error} = await stripe.confirmOxxoPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: { billing_details: { name: 'Fulano de Tal', email: 'fulano@example.com', }, }, } ); ``` ### Use case: with an existing payment method If you have already created a `PaymentMethod`, you can pass its `id` to `payment_method` when calling `stripe.confirmOxxoPayment`. It will be used to confirm the `PaymentIntent`. ### Data argument properties - `payment_method` (string) **required** The `id` of an existing [PaymentMethod](/api/payment_methods.md). ### Confirm with existing payment method ```js stripe.confirmOxxoPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: '{PAYMENT_METHOD_ID}', } ).then(function(result) { // Handle result.error or result.paymentIntent }); ``` ```es_next const {paymentIntent, error} = await stripe.confirmOxxoPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: '{PAYMENT_METHOD_ID}', } ); ``` ### Use case: with an attached PaymentMethod If you have already attached a `PaymentMethod` to this `PaymentIntent`, then you can confirm the `PaymentIntent` using `stripe.confirmOxxoPayment` without passing in any additional data. ### Confirm with an attached PaymentMethod ```js stripe.confirmOxxoPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', {} ).then(function(result) { // Handle result.error or result.paymentIntent }); ``` ```es_next const {paymentIntent, error} = await stripe.confirmOxxoPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', {} ); ``` ### Confirm an Oxxo payment ```js stripe.confirmOxxoPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: { billing_details: { name: 'Fulano de Tal', email: 'fulano@example.com', }, }, } ).then(function(result) { // Handle result.error or result.paymentIntent }); ``` ```es_next const {paymentIntent, error} = await stripe.confirmOxxoPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: { billing_details: { name: 'Fulano de Tal', email: 'fulano@example.com', }, }, } ); ``` ## Confirm a Przelewy24 payment Use `stripe.confirmP24Payment` in the [Przelewy24 Payments with Payment Methods](/payments/p24/accept-a-payment.md) flow when the customer submits your payment form. When called, it will confirm the `PaymentIntent` with `data` you provide, and it will automatically redirect the customer to authorize the transaction. Once authorization is complete, the customer will be redirected back to your specified `return_url`. When you confirm a `PaymentIntent`, it needs to have an attached [PaymentMethod](/api/payment_methods.md). In addition to confirming the `PaymentIntent`, this method can automatically create and attach a new `PaymentMethod` for you. If you have already attached a `PaymentMethod` you can call this method without needing to provide any additional data. These use cases are detailed in the sections that follow. > Note that `stripe.confirmP24Payment` may take several seconds to complete. > During that time, you should disable your form from being resubmitted and show a waiting indicator like a spinner. > If you receive an error result, you should be sure to show that error to the customer, re-enable the form, and hide the waiting indicator. `stripe.confirmP24Payment` will trigger a redirect when successful. If there is an error, it will return a `Promise` which resolves with a `result` object. This object has either: * `result.paymentIntent`: the successful [PaymentIntent](/api/payment_intents). * `result.error`: an error. Refer to the [API reference](/api/errors) for all possible errors. **Syntax:** `stripe.confirmP24Payment(...)` - `clientSecret` (string) **required** The [client secret](/api/payment_intents/object.md#payment_intent_object-client_secret) of the `PaymentIntent`. - `data` (object) Data to be sent with the request. Refer to the [Payment Intents API](/api/payment_intents/confirm.md) for a full list of parameters. - `payment_method` (string | object) Either the `id` of an existing [PaymentMethod](/api/payment_methods.md), or an object containing data to create a `PaymentMethod` with. See the use case sections below for details. - `return_url` (string) The url your customer will be directed to after they complete authentication. - `options` (object) An options object to control the behavior of this method. - `handleActions` (boolean) Set this to `false` if you want to [manually handle the authorization redirect](/payments/p24/accept-a-payment?platform=web.md#handle-redirect). Default is `true`. ### Use case: with an existing payment method Use `stripe.confirmP24Payment` with an existing `PaymentMethod` by passing its `id` to `payment_method`. The `PaymentMethod` will be used to confirm the `PaymentIntent`. ### Data argument properties - `payment_method` (string) **required** The `id` of an existing `PaymentMethod`. - `return_url` (string) The url your customer will be directed to after they complete authentication. ### Confirm with existing payment method ```js stripe .confirmP24Payment('{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: '{PAYMENT_METHOD_ID}', // Return URL where the customer should be redirected after the authorization. return_url: window.location.href, }) .then(function(result) { // Inform the customer that there was an error. }); ``` ```es_next const {error} = await stripe.confirmP24Payment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: '{PAYMENT_METHOD_ID}', // Return URL where the customer should be redirected after the authorization. return_url: window.location.href, }, ); ``` ### Use case: with collected data Your customer's email address is required for the Przelewy24 authorization to succeed. You can pass in the customer’s email address directly to create a new `PaymentMethod` and confirm the `PaymentIntent`. ### Data argument properties - `payment_method` (object) **required** Pass an object to confirm with the customer's email address. - `billing_details` (object) **required** An object detailing billing information. - `email` (string) **required** The customer's email address. - `return_url` (string) The url your customer will be directed to after they complete authentication. ### Confirm with self collected data ```js stripe .confirmP24Payment('{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: { billing_details: { email: 'jenny.rosen@example.com', }, }, // Return URL where the customer should be redirected after the authorization. return_url: window.location.href, }) .then(function(result) { if (result.error) { // Inform the customer that there was an error. } }); ``` ```es_next const {error} = await stripe.confirmP24Payment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: { billing_details: { email: 'jenny.rosen@example.com', }, }, // Return URL where the customer should be redirected after the authorization. return_url: window.location.href, }, ); ``` ### Use case: with an attached PaymentMethod If you have already attached a `PaymentMethod` to this `PaymentIntent`, then you can confirm the `PaymentIntent` using `stripe.confirmP24Payment` without passing in any additional data. ### Confirm with an attached PaymentMethod ```js stripe .confirmP24Payment('{PAYMENT_INTENT_CLIENT_SECRET}') .then(function(result) { // Handle result.error or result.paymentIntent }); ``` ```es_next const {paymentIntent, error} = await stripe.confirmP24Payment( '{PAYMENT_INTENT_CLIENT_SECRET}', ); ``` ### Confirm a P24 payment ```js stripe .confirmP24Payment('{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: { billing_details: { email: 'jenny.rosen@example.com', }, }, // Return URL where the customer should be redirected after the authorization. return_url: window.location.href, }) .then(function(result) { if (result.error) { // Inform the customer that there was an error. } }); ``` ```es_next const {error} = await stripe.confirmP24Payment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: { billing_details: { email: 'jenny.rosen@example.com', }, }, // Return URL where the customer should be redirected after the authorization. return_url: window.location.href, }, ); ``` ## Confirm a Pay by Bank payment Use `stripe.confirmPayByBankPayment` in the [Pay by Bank Payments with Payment Methods](/payments/pay-by-bank.md) flow when the customer submits your payment form. When called, it confirms the `PaymentIntent` with `data` you provide. It then automatically redirects the customer to authorize the transaction. After authorization is complete, the customer is redirected back to your specified `return_url`. When you confirm a `PaymentIntent`, it needs to have an attached [PaymentMethod](/api/payment_methods.md). In addition to confirming the `PaymentIntent`, this method can automatically create and attach a new `PaymentMethod` for you. If you have already attached a `PaymentMethod` you can call this method without providing any additional data. These use cases are detailed in the sections that follow. > Be aware that `stripe.confirmPayByBankPayment` might take several seconds to complete. > During that time, disable your form from being resubmitted and show a waiting indicator like a spinner. > If you receive an error result, show that error to the customer, re-enable the form, and hide the waiting indicator. `stripe.confirmPayByBankPayment` will trigger a redirect when successful. If there's an error, it returns a `Promise` which resolves with a `result` object. This object has either: * `result.paymentIntent`: the successful [PaymentIntent](/api/payment_intents). * `result.error`: an error. Refer to the [API reference](/api/errors) for all possible errors. **Syntax:** `stripe.confirmPayByBankPayment(...)` - `clientSecret` (string) **required** The [client secret](/api/payment_intents/object.md#payment_intent_object-client_secret) of the `PaymentIntent`. - `data` (object) Data to be sent with the request. Refer to the [Payment Intents API](/api/payment_intents/confirm.md) for a full list of parameters. - `payment_method` (string | object) **required** Either the `id` of an existing [PaymentMethod](/api/payment_methods.md), or an object containing data to create a `PaymentMethod` with. See the use case sections below for details. - `return_url` (string) **required** The url your customer will be directed to after they complete authentication. - `options` (object) An options object to control the behavior of this method. - `handleActions` (boolean) Set this to `false` if you want to [manually handle the authorization redirect](/payments/pay-by-bank/accept-a-payment?platform=web.md#handle-redirect). Default is `true`. ### Use case: with a new PaymentMethod If you haven't already created a `PaymentMethod`, you can pass payment method parameters, and the newly created `PaymentMethod` will be used to confirm the `PaymentIntent`. ### Data argument properties - `payment_method` (object) **required** An object containing data to create a `PaymentMethod` with. - `return_url` (string) **required** The url you redirect your customer to after they complete authentication. ### Confirm with a new PaymentMethod ```js stripe .confirmPayByBankPayment('{PAYMENT_INTENT_CLIENT_SECRET}', { // Return URL where the customer should be redirected after // the authorization. return_url: window.location.href, }) .then(function(result) { if (result.error) { // Inform the customer that there was an error. } }); ``` ```es_next const {error} = await stripe.confirmPayByBankPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { // Return URL where the customer should be redirected after // the authorization. return_url: window.location.href, }, ); ``` ### Use case: with an existing payment method Use `stripe.confirmPayByBankPayment` with an existing `PaymentMethod` by passing its `id` to `payment_method`. The `PaymentMethod` will be used to confirm the `PaymentIntent`. ### Data argument properties - `payment_method` (string) **required** The `id` of an existing `PaymentMethod`. - `return_url` (string) **required** The url you redirect your customer to after they complete authentication. ### Confirm with existing payment method ```js stripe .confirmPayByBankPayment('{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: '{PAYMENT_METHOD_ID}', // Return URL where the customer should be redirected after the authorization. return_url: window.location.href, }) .then(function(result) { // Inform the customer that there was an error. }); ``` ```es_next const {error} = await stripe.confirmPayByBankPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: '{PAYMENT_METHOD_ID}', // Return URL where the customer should be redirected after the authorization. return_url: window.location.href, }, ); ``` ### Confirm a Pay by Bank payment ```js stripe .confirmPayByBankPayment('{PAYMENT_INTENT_CLIENT_SECRET}', { // Return URL where the customer should be redirected after // the authorization. return_url: window.location.href, }) .then(function(result) { if (result.error) { // Inform the customer that there was an error. } }); ``` ```es_next const {error} = await stripe.confirmPayByBankPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { // Return URL where the customer should be redirected after // the authorization. return_url: window.location.href, }, ); ``` ## Confirm a PayNow payment Use `stripe.confirmPayNowPayment` in the PayNow payment method creation flow when the customer submits your payment form. When called, it will confirm the [PaymentIntent](/api/payment_intents.md) with `data` you provide and handle the [NextAction](/api/payment_intents/object.md#payment_intent_object-next_action) for the customer to authorize the payment. When you confirm a `PaymentIntent`, it needs to have an attached [PaymentMethod](/api/payment_methods.md). In addition to confirming the `PaymentIntent`, this method can automatically create and attach a new `PaymentMethod` for you. If you have already attached a `PaymentMethod` you can call this method without needing to provide any additional data. These use cases are detailed in the sections that follow. > Note that `stripe.confirmPayNowPayment` may take several seconds to complete and display the QR code. > During that time, you should disable your form from being resubmitted and show a waiting indicator like a spinner. > If you receive an error result, you should be sure to show that error to the customer, re-enable the form, and hide the waiting indicator. By default, `stripe.confirmPayNowPayment` will display the PayNow QR code overlay. If there is an error, or when handling next actions manually by using the `handleActions: false` option, it will return a `Promise` which resolves with a `result` object. This object has either: * `result.paymentIntent`: the successful [PaymentIntent](/api/payment_intents). * `result.error`: an error. Refer to the [API reference](/api/errors) for all possible errors. **Syntax:** `stripe.confirmPayNowPayment(...)` - `clientSecret` (string) **required** The [client secret](/api/payment_intents/object.md#payment_intent_object-client_secret) of the `PaymentIntent`. - `data` (object) Data to be sent with the request. Refer to the [Payment Intents API](/api/payment_intents/confirm.md) for a full list of parameters. - `payment_method` (string | object) Either the `id` of an existing [PaymentMethod](/api/payment_methods.md), or an object containing data to create a `PaymentMethod` with. See the use case sections below for details. - `options` (object) An options object to control the behavior of this method. - `handleActions` (boolean) Default is `true`. Set this to `false` if you would like to [handle displaying the PayNow QR code yourself](/payments/paynow.md#confirm-payment-intent). ### Use case: Without an existing payment method If you have not already created a `PaymentMethod`, you can pass payment method parameters, and the newly created `PaymentMethod` will be used to confirm the `PaymentIntent`. ### Data argument properties - `payment_method` (object) **required** Pass payment method billing details. - `billing_details` (object) The [billing_details](/api/payment_methods/create.md#create_payment_method-billing_details) associated with the payment method. ### Confirm without existing payment method ```js stripe.confirmPayNowPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: { billing_details: { name: '{NAME}', email: '{EMAIL}' }, }, } ).then(function({error, paymentIntent}) { if (error) { // Inform the customer that there was an error. } else if (paymentIntent.status === 'succeeded') { // Inform the customer that the payment was successful } else if (paymentIntent.status === 'requires_action') { // Inform the customer that the payment did not go through } }); ``` ```es_next const {error, paymentIntent} = await stripe.confirmPayNowPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: { billing_details: { name: '{NAME}', email: '{EMAIL}' }, }, } ); if (error) { // Inform the customer that there was an error. } else if (paymentIntent.status === 'succeeded') { // Inform the customer that the payment was successful } else if (paymentIntent.status === 'requires_action') { // Inform the customer that the payment did not go through } ``` ### Use case: With an existing payment method If you have already created a `PaymentMethod`, you can pass its `id` to `payment_method` and it will be used to confirm the `PaymentIntent`. ### Data argument properties - `payment_method` (string) **required** The `id` of an existing `PaymentMethod`. ### Confirm with existing payment method ```js stripe.confirmPayNowPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: '{PAYMENT_METHOD_ID}', } ).then(function({error, paymentIntent}) { if (error) { // Inform the customer that there was an error. } else if (paymentIntent.status === 'succeeded') { // Inform the customer that the payment was successful } else if (paymentIntent.status === 'requires_action') { // Inform the customer that the payment did not go through } }); ``` ```es_next const {error} = await stripe.confirmPayNowPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: '{PAYMENT_METHOD_ID}', } ); if (error) { // Inform the customer that there was an error. } else if (paymentIntent.status === 'succeeded') { // Inform the customer that the payment was successful } else if (paymentIntent.status === 'requires_action') { // Inform the customer that the payment did not go through } ``` ### Use case: With an attached PaymentMethod If you have already attached a `PaymentMethod` to this `PaymentIntent`, then you can confirm without passing in any additional data. ### Confirm with an attached PaymentMethod ```js stripe.confirmPayNowPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', {} ).then(function({error, paymentIntent}) { if (error) { // Inform the customer that there was an error. } else if (paymentIntent.status === 'succeeded') { // Inform the customer that the payment was successful } else if (paymentIntent.status === 'requires_action') { // Inform the customer that the payment did not go through } }); ``` ```es_next const {error} = await stripe.confirmPayNowPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', {} ); if (error) { // Inform the customer that there was an error. } else if (paymentIntent.status === 'succeeded') { // Inform the customer that the payment was successful } else if (paymentIntent.status === 'requires_action') { // Inform the customer that the payment did not go through } ``` ### Confirm a PayNow payment ```js stripe.confirmPayNowPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', {} ).then(function({error, paymentIntent}) { if (error) { // Inform the customer that there was an error. } else if (paymentIntent.status === 'succeeded') { // Inform the customer that the payment was successful } else if (paymentIntent.status === 'requires_action') { // Inform the customer that the payment did not go through } }); ``` ```es_next const {error} = await stripe.confirmPayNowPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', {} ); if (error) { // Inform the customer that there was an error. } else if (paymentIntent.status === 'succeeded') { // Inform the customer that the payment was successful } else if (paymentIntent.status === 'requires_action') { // Inform the customer that the payment did not go through } ``` ## Confirm a PayPal payment Use `stripe.confirmPayPalPayment` in the [PayPal Payments with Payment Methods](/payments/paypal/accept-a-payment.md) flow when the customer submits your payment form. When called, it will confirm the `PaymentIntent`, and it will automatically redirect the customer to authorize the transaction. Once authorization is complete, the customer will be redirected back to your specified `return_url`. > Note that `stripe.confirmPayPalPayment` may take several seconds to complete. > During that time, you should disable your form from being resubmitted and show a waiting indicator like a spinner. > If you receive an error result, you should be sure to show that error to the customer, re-enable the form, and hide the waiting indicator. `stripe.confirmPayPalPayment` will trigger a redirect when successful. If there is an error, it will return a `Promise` which resolves with a `result` object. This object has either: * `result.paymentIntent`: the successful [PaymentIntent](/api/payment_intents). * `result.error`: an error. Refer to the [API reference](/api/errors) for all possible errors. **Syntax:** `stripe.confirmPayPalPayment(...)` - `clientSecret` (string) **required** The [client secret](/api/payment_intents/object.md#payment_intent_object-client_secret) of the `PaymentIntent`. - `data` (object) Data to be sent with the request. Refer to the [Payment Intents API](/api/payment_intents/confirm.md) for a full list of parameters. - `payment_method` (string | object) The `id` of an existing [PaymentMethod](/api/payment_methods.md). See the use case sections below for details. - `return_url` (string) The url your customer will be directed to after they complete authentication. Required for new PayPal payment methods, but not required when using a previously set up PayPal payment method (via SetupIntent or a PaymentIntent with `setup_future_usage`). ### Use case: with a new PaymentMethod You can confirm the `PaymentIntent` using `stripe.confirmPayPalPayment` without passing in any additional data. This will automatically create and attach a new `PaymentMethod`. ### Data argument properties - `return_url` (string) The url your customer will be directed to after they complete authentication. Required for new PayPal payment methods, but not required when using a previously set up PayPal payment method (via SetupIntent or a PaymentIntent with `setup_future_usage`). ### Confirm with a new PaymentMethod ```js stripe .confirmPayPalPayment('{PAYMENT_INTENT_CLIENT_SECRET}', { // Return URL where the customer should be redirected after // the authorization. return_url: "https://example.com/checkout/complete", }) .then(function(result) { if (result.error) { // Inform the customer that there was an error. } }); ``` ```es_next const {error} = await stripe.confirmPayPalPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { // Return URL where the customer should be redirected after // the authorization. return_url: "https://example.com/checkout/complete", }, ); ``` ### Use case: with an existing payment method Use `stripe.confirmPayPalPayment` with an existing `PaymentMethod` by passing its `id` to `payment_method`. The `PaymentMethod` will be used to confirm the `PaymentIntent`. ### Data argument properties - `payment_method` (string) **required** The `id` of an existing `PaymentMethod`. - `return_url` (string) The url your customer will be directed to after they complete authentication. Required for new PayPal payment methods, but not required when using a previously set up PayPal payment method (via SetupIntent or a PaymentIntent with `setup_future_usage`). ### Confirm with existing payment method ```js stripe .confirmPayPalPayment('{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: '{PAYMENT_METHOD_ID}', // Return URL where the customer should be redirected after the authorization. return_url: "https://example.com/checkout/complete", }) .then(function(result) { if (result.error) { // Inform the customer that there was an error. } }); ``` ```es_next const {error} = await stripe.confirmPayPalPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: '{PAYMENT_METHOD_ID}', // Return URL where the customer should be redirected after the authorization. return_url: "https://example.com/checkout/complete", }, ); ``` ### Use case: with an attached PaymentMethod If you have already attached a `PaymentMethod` to this `PaymentIntent`, then you can confirm the `PaymentIntent` using `stripe.confirmPayPalPayment` without passing in any additional data. ### Confirm with an attached PaymentMethod ```js stripe .confirmPayPalPayment('{PAYMENT_INTENT_CLIENT_SECRET}', { // Return URL where the customer should be redirected after // the authorization. return_url: "https://example.com/checkout/complete", }) .then(function(result) { if (result.error) { // Inform the customer that there was an error. } }); ``` ```es_next const {paymentIntent, error} = await stripe.confirmPayPalPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { // Return URL where the customer should be redirected after // the authorization. return_url: "https://example.com/checkout/complete", }, ); ``` ### Confirm a PayPal payment ```js stripe .confirmPayPalPayment('{PAYMENT_INTENT_CLIENT_SECRET}', { // Return URL where the customer should be redirected after // the authorization. return_url: "https://example.com/checkout/complete", }) .then(function(result) { if (result.error) { // Inform the customer that there was an error. } }); ``` ```es_next const {error} = await stripe.confirmPayPalPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { // Return URL where the customer should be redirected after // the authorization. return_url: "https://example.com/checkout/complete", }, ); ``` ## Confirm a PayTo payment Use `stripe.confirmPayToPayment` in the PayTo payment method creation flow when the customer submits your payment form. When you call the method, it confirms the [PaymentIntent](/api/payment_intents.md) with the `data` you provide, and sends a request to the customer to authorize the transaction. When you confirm a `PaymentIntent`, it needs to have an attached [PaymentMethod](/api/payment_methods.md). In addition to confirming the `PaymentIntent`, this method can automatically create and attach a new `PaymentMethod` for you. If you've already attached a `PaymentMethod`, you can call this method without needing to provide any additional data. These use cases are detailed in the sections that follow. > Note that `stripe.confirmPayToPayment` might take some time to complete while waiting for customers to authorize the PayTo agreement, and while waiting for funds to transfer. > During that time, you should disable your form from being resubmitted and show a waiting indicator like a spinner. > If you receive an error result, show that error to the customer, re-enable the form, and hide the waiting indicator. By default, `stripe.confirmPayToPayment` will poll for updates to the `PaymentIntent`. If there's an error, or when handling `next_action`s manually by using the `handleActions: false` option, it returns a `Promise` which resolves with a `result` object. This object has either: * `result.paymentIntent`: the successful [PaymentIntent](/api/payment_intents). * `result.error`: an error. Refer to the [API reference](/api/errors) for all possible errors. **Syntax:** `stripe.confirmPayToPayment(...)` - `clientSecret` (string) **required** The [client secret](/api/payment_intents/object.md#payment_intent_object-client_secret) of the `PaymentIntent`. - `data` (object) Data to be sent with the request. Refer to the [Payment Intents API](/api/payment_intents/confirm.md) for a full list of parameters. - `payment_method` (string | object) Either the `id` of an existing [PaymentMethod](/api/payment_methods.md), or an object containing data to create a `PaymentMethod` with. See the use case sections below for details. - `options` (object) An options object to control the behavior of this method. - `handleActions` (boolean) Set this to `false` if you want to manually handle polling for PaymentIntent updates. Default is `true`. ### Use case: without an existing payment method If you haven't already created a `PaymentMethod`, you can pass payment method parameters, and the newly created `PaymentMethod` is used to confirm the `PaymentIntent`. ### Data argument properties - `payment_method` (object) **required** Pass payment method billing details. - `billing_details` (object) **required** The [billing_details](/api/payment_methods/create.md#create_payment_method-billing_details) associated with the payment. The email is required if the customer is paying with PayID. - `email` (string) - `name` (string) **required** - `payto` (object) **required** The [PayTo payment method details](/api/payment_methods/create.md#create_payment_method-payto) associated with the customer's bank account. Either `pay_id` or `account_number` and `bsb_number` must be provided. - `pay_id` (string) - `account_number` (string) - `bsb_number` (string) ### Confirm without existing payment method ```js stripe.confirmPayToPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: { billing_details: { name: 'Jenny Rosen', // Email is only required if `pay_id` is used email: 'jenny@example.com' }, payto: { pay_id: 'jenny@example.com' // Alternatively, provide bank account details account_number: '000123456', bsb_number: '000000' } } } ).then(function(result) { if (result.error) { // Inform the customer that there was an error. } }); ``` ```es_next const {paymentIntent, error} = await stripe.confirmPayToPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: { billing_details: { name: 'Jenny Rosen', // Email is only required if `pay_id` is used email: 'jenny@example.com' }, payto: { pay_id: 'jenny@example.com' // Alternatively, provide bank account details account_number: '000123456', bsb_number: '000000' } } } ); ``` ### Use case: with an existing payment method If you've already created a `PaymentMethod`, you can pass its `id` to `payment_method`, which is used to confirm the `PaymentIntent`. ### Data argument properties - `payment_method` (string) **required** The `id` of an existing `PaymentMethod`. ### Confirm with existing payment method ```js stripe.confirmPayToPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: '{PAYMENT_METHOD_ID}' } ).then(function(result) { // Inform the customer that there was an error. }); ``` ```es_next const {paymentIntent, error} = await stripe.confirmPayToPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: '{PAYMENT_METHOD_ID}' } ); ``` ### Use case: with an attached PaymentMethod If you've already attached a `PaymentMethod` to this `PaymentIntent`, you can confirm it without passing in any additional data. ### Confirm with an attached PaymentMethod ```js stripe .confirmPayToPayment('{PAYMENT_INTENT_CLIENT_SECRET}') .then(function(result) { if (result.error) { // Inform the customer that there was an error. } }); ``` ```es_next const {paymentIntent, error} = await stripe.confirmPayToPayment('{PAYMENT_INTENT_CLIENT_SECRET}'); ``` ### Confirm a PayTo payment ```js stripe .confirmPayToPayment('{PAYMENT_INTENT_CLIENT_SECRET}') .then(function(result) { if (result.error) { // Inform the customer that there was an error. } }); ``` ```es_next const {paymentIntent, error} = await stripe.confirmPayToPayment('{PAYMENT_INTENT_CLIENT_SECRET}'); ``` ## Confirm a Pix payment Use `stripe.confirmPixPayment` in the [Pix Payment](/payments/pix.md) with Payment Methods flow when the customer submits your payment form. When called, it will confirm the [PaymentIntent](/api/payment_intents.md) with `data` you provide. Note that there are some additional requirements to this flow that are not covered in this reference. Refer to our [integration guide](/payments/pix.md) for more details. When you confirm a `PaymentIntent`, it needs to have an attached [PaymentMethod](/api/payment_methods.md). In addition to confirming the `PaymentIntent`, this method can automatically create and attach a new PaymentMethod for you. If you have already attached a `PaymentMethod` you can call this method without needing to provide any additional data. These use cases are detailed in the sections that follow. > Note that `stripe.confirmPixPayment` may take several seconds to complete and display the QR code. > During that time, you should disable your form from being resubmitted and show a waiting indicator like a spinner. > If you receive an error result, you should be sure to show that error to the customer, re-enable the form, and hide the waiting indicator. By default, `stripe.confirmPixPayment` will display the Pix QR code overlay. If there is an error, or when handling next actions manually by using the `handleActions: false` option, it will return a `Promise` which resolves with a `result` object. This object has either: * `result.paymentIntent`: the successful [PaymentIntent](/api/payment_intents). * `result.error`: an error. Refer to the [API reference](/api/errors) for all possible errors. **Syntax:** `stripe.confirmPixPayment(...)` - `clientSecret` (string) **required** The [client secret](/api/payment_intents/object.md#payment_intent_object-client_secret) of the `PaymentIntent`. - `data` (object) Data to be sent with the request. Refer to the [Payment Intents API](/api/payment_intents/confirm.md) for a full list of parameters. - `payment_method` (string | object) Either the `id` of an existing [PaymentMethod](/api/payment_methods.md), or an object containing data to create a `PaymentMethod` with. See the use case sections below for details. - `options` (object) An options object to control the behavior of this method. - `handleActions` (boolean) Default to be `true`. Set this to `false` if you would like to [handle displaying the Pix QR code yourself](/payments/pix/accept-a-payment.md#confirm-payment-intent). ### Use case: without an existing payment method If you have not already created a `PaymentMethod`, you can pass payment method parameters, and the newly created `PaymentMethod` will be used to confirm the `PaymentIntent`. ### Data argument properties - `payment_method` (object) **required** Pass payment method paramters or and empty payment method object. ### Confirm without existing payment method ```js stripe.confirmPixPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: {}, } ).then(function(result) { // Handle result.error or result.paymentIntent }); ``` ```es_next const {paymentIntent, error} = await stripe.confirmPixPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: {}, } ); ``` ### Use case: with an existing payment method If you have already created a `PaymentMethod`, you can pass its `id` to `payment_method` and it will be used to confirm the `PaymentIntent`. ### Data argument properties - `payment_method` (string) **required** The `id` of an existing [PaymentMethod](/api/payment_methods.md). ### Confirm with existing payment method ```js stripe.confirmPixPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: '{PAYMENT_METHOD_ID}', } ).then(function(result) { // Handle result.error or result.paymentIntent }); ``` ```es_next const {paymentIntent, error} = await stripe.confirmPixPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: '{PAYMENT_METHOD_ID}', } ); ``` ### Use case: with an attached PaymentMethod If you have already attached a `PaymentMethod` to this `PaymentIntent`, then you can confirm without passing in any additional data. ### Confirm with an attached PaymentMethod ```js stripe.confirmPixPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', {} ).then(function(result) { // Handle result.error or result.paymentIntent }); ``` ```es_next const {paymentIntent, error} = await stripe.confirmPixPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', {} ); ``` ### Confirm a Pix payment ```js stripe.confirmPixPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', {} ).then(function(result) { // Handle result.error or result.paymentIntent }); ``` ```es_next const {paymentIntent, error} = await stripe.confirmPixPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', {} ); ``` ## Confirm a PromptPay payment Use `stripe.confirmPromptPayPayment` in the PromptPay payment method creation flow when the customer submits your payment form. When called, it will confirm the [PaymentIntent](/api/payment_intents.md) with `data` you provide and handle the [NextAction](/api/payment_intents/object.md#payment_intent_object-next_action) for the customer to authorize the payment. When you confirm a `PaymentIntent`, it needs to have an attached [PaymentMethod](/api/payment_methods.md). In addition to confirming the `PaymentIntent`, this method can automatically create and attach a new `PaymentMethod` for you. If you have already attached a `PaymentMethod` you can call this method without needing to provide any additional data. These use cases are detailed in the sections that follow. > Note that `stripe.confirmPromptPayPayment` may take several seconds to complete and display the QR code. > During that time, you should disable your form from being resubmitted and show a waiting indicator like a spinner. > If you receive an error result, you should be sure to show that error to the customer, re-enable the form, and hide the waiting indicator. By default, `stripe.confirmPromptPayPayment` will display the PromptPay QR code overlay. If there is an error, or when handling next actions manually by using the `handleActions: false` option, it will return a `Promise` which resolves with a `result` object. This object has either: * `result.paymentIntent`: the successful [PaymentIntent](/api/payment_intents). * `result.error`: an error. Refer to the [API reference](/api/errors) for all possible errors. **Syntax:** `stripe.confirmPromptPayPayment(...)` - `clientSecret` (string) **required** The [client secret](/api/payment_intents/object.md#payment_intent_object-client_secret) of the `PaymentIntent`. - `data` (object) Data to be sent with the request. Refer to the [Payment Intents API](/api/payment_intents/confirm.md) for a full list of parameters. - `payment_method` (string | object) Either the `id` of an existing [PaymentMethod](/api/payment_methods.md), or an object containing data to create a `PaymentMethod` with. See the use case sections below for details. - `options` (object) An options object to control the behavior of this method. - `handleActions` (boolean) Default to be `true`. Set this to `false` if you would like to [handle displaying the PromptPay QR code yourself](/payments/promptpay/accept-a-payment.md#confirm-payment-intent). ### Use case: Without an existing payment method If you have not already created a `PaymentMethod`, you can pass payment method parameters, and the newly created `PaymentMethod` will be used to confirm the `PaymentIntent`. ### Data argument properties - `payment_method` (object) **required** Pass payment method billing details. - `billing_details` (object) The [billing_details](/api/payment_methods/create.md#create_payment_method-billing_details) associated with the payment method. ### Confirm without existing payment method ```js stripe.confirmPromptPayPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: { billing_details: { name: '{NAME}', email: '{EMAIL}' }, }, } ).then(function({error, paymentIntent}) { if (error) { // Inform the customer that there was an error. } else if (paymentIntent.status === 'succeeded') { // Inform the customer that the payment was successful } else if (paymentIntent.status === 'requires_action') { // Inform the customer that the payment did not go through } }); ``` ```es_next const {error, paymentIntent} = await stripe.confirmPromptPayPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: { billing_details: { name: '{NAME}', email: '{EMAIL}' }, }, } ); if (error) { // Inform the customer that there was an error. } else if (paymentIntent.status === 'succeeded') { // Inform the customer that the payment was successful } else if (paymentIntent.status === 'requires_action') { // Inform the customer that the payment did not go through } ``` ### Use case: With an existing payment method If you have already created a `PaymentMethod`, you can pass its `id` to `payment_method` and it will be used to confirm the `PaymentIntent`. ### Data argument properties - `payment_method` (string) **required** The `id` of an existing `PaymentMethod`. ### Confirm with existing payment method ```js stripe.confirmPromptPayPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: '{PAYMENT_METHOD_ID}', } ).then(function({error, paymentIntent}) { if (error) { // Inform the customer that there was an error. } else if (paymentIntent.status === 'succeeded') { // Inform the customer that the payment was successful } else if (paymentIntent.status === 'requires_action') { // Inform the customer that the payment did not go through } }); ``` ```es_next const {error} = await stripe.confirmPromptPayPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: '{PAYMENT_METHOD_ID}', } ); if (error) { // Inform the customer that there was an error. } else if (paymentIntent.status === 'succeeded') { // Inform the customer that the payment was successful } else if (paymentIntent.status === 'requires_action') { // Inform the customer that the payment did not go through } ``` ### Use case: With an attached PaymentMethod If you have already attached a `PaymentMethod` to this `PaymentIntent`, then you can confirm without passing in any additional data. ### Confirm with an attached PaymentMethod ```js stripe.confirmPromptPayPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', {} ).then(function({error, paymentIntent}) { if (error) { // Inform the customer that there was an error. } else if (paymentIntent.status === 'succeeded') { // Inform the customer that the payment was successful } else if (paymentIntent.status === 'requires_action') { // Inform the customer that the payment did not go through } }); ``` ```es_next const {error} = await stripe.confirmPromptPayPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', {} ); if (error) { // Inform the customer that there was an error. } else if (paymentIntent.status === 'succeeded') { // Inform the customer that the payment was successful } else if (paymentIntent.status === 'requires_action') { // Inform the customer that the payment did not go through } ``` ### Confirm a PromptPay payment ```js stripe.confirmPromptPayPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', {} ).then(function({error, paymentIntent}) { if (error) { // Inform the customer that there was an error. } else if (paymentIntent.status === 'succeeded') { // Inform the customer that the payment was successful } else if (paymentIntent.status === 'requires_action') { // Inform the customer that the payment did not go through } }); ``` ```es_next const {error} = await stripe.confirmPromptPayPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', {} ); if (error) { // Inform the customer that there was an error. } else if (paymentIntent.status === 'succeeded') { // Inform the customer that the payment was successful } else if (paymentIntent.status === 'requires_action') { // Inform the customer that the payment did not go through } ``` ## Confirm a QRIS payment Use `stripe.confirmQrisPayment` in the [QRIS Payments with Payment Methods](/payments/qris/accept-a-payment.md) flow when the customer submits your payment form. When called, it will confirm the `PaymentIntent` with `data` you provide, and it will automatically redirect the customer to authorize the transaction. Once authorization is complete, the customer will be redirected back to your specified `return_url`. When you confirm a `PaymentIntent`, it needs to have an attached [PaymentMethod](/api/payment_methods.md). In addition to confirming the `PaymentIntent`, this method can automatically create and attach a new `PaymentMethod` for you. If you have already attached a `PaymentMethod` you can call this method without needing to provide any additional data. These use cases are detailed in the sections that follow. > Note that `stripe.confirmQrisPayment` may take several seconds to complete. > During that time, you should disable your form from being resubmitted and show a waiting indicator like a spinner. > If you receive an error result, you should be sure to show that error to the customer, re-enable the form, and hide the waiting indicator. `stripe.confirmQrisPayment` will trigger a redirect when successful. If there is an error, it will return a `Promise` which resolves with a `result` object. This object has either: * `result.paymentIntent`: the successful [PaymentIntent](/api/payment_intents). * `result.error`: an error. Refer to the [API reference](/api/errors) for all possible errors. **Syntax:** `stripe.confirmQrisPayment(...)` - `clientSecret` (string) **required** The [client secret](/api/payment_intents/object.md#payment_intent_object-client_secret) of the `PaymentIntent`. - `data` (object) Data to be sent with the request. Refer to the [Payment Intents API](/api/payment_intents/confirm.md) for a full list of parameters. - `payment_method` (string | object) Either the `id` of an existing [PaymentMethod](/api/payment_methods.md), or an object containing data to create a `PaymentMethod` with. See the use case sections below for details. - `return_url` (string) The url your customer will be directed to after they complete authentication. - `options` (object) An options object to control the behavior of this method. - `handleActions` (boolean) Set this to `false` if you want to [manually handle the authorization redirect](/payments/qris/accept-a-payment?platform=web.md#handle-redirect). Default is `true`. ### Use case: with an existing payment method Use `stripe.confirmQrisPayment` with an existing `PaymentMethod` by passing its `id` to `payment_method`. The `PaymentMethod` will be used to confirm the `PaymentIntent`. ### Data argument properties - `payment_method` (string) **required** The `id` of an existing `PaymentMethod`. - `return_url` (string) The url your customer will be directed to after they complete authentication. ### Confirm with existing payment method ```js stripe .confirmQrisPayment('{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: '{PAYMENT_METHOD_ID}', // Return URL where the customer should be redirected after the authorization. return_url: window.location.href, }) .then(function(result) { // Inform the customer that there was an error. }); ``` ```es_next const {error} = await stripe.confirmQrisPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: '{PAYMENT_METHOD_ID}', // Return URL where the customer should be redirected after the authorization. return_url: window.location.href, }, ); ``` ### Use case: with collected data Your customer's name is required for the QRIS authorization to succeed. You can pass in the customer’s name directly to create a new `PaymentMethod` and confirm the `PaymentIntent`. ### Data argument properties - `payment_method` (object) **required** Pass an object to confirm with the customer's name. - `billing_details` (object) **required** An object detailing billing information. - `name` (string) **required** The customer's name. - `return_url` (string) The url your customer will be directed to after they complete authentication. ### Confirm with self collected data ```js stripe .confirmQrisPayment('{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: { billing_details: { name: 'Jenny Rosen', }, }, // Return URL where the customer should be redirected after the authorization. return_url: window.location.href, }) .then(function(result) { if (result.error) { // Inform the customer that there was an error. } }); ``` ```es_next const {error} = await stripe.confirmQrisPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: { billing_details: { name: 'Jenny Rosen', }, }, // Return URL where the customer should be redirected after the authorization. return_url: window.location.href, }, ); ``` ### Use case: with an attached PaymentMethod If you have already attached a `PaymentMethod` to this `PaymentIntent`, then you can confirm the `PaymentIntent` using `stripe.confirmQrisPayment` without passing in any additional data. ### Confirm with an attached PaymentMethod ```js stripe .confirmQrisPayment('{PAYMENT_INTENT_CLIENT_SECRET}') .then(function(result) { // Handle result.error or result.paymentIntent }); ``` ```es_next const {paymentIntent, error} = await stripe.confirmQrisPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', ); ``` ### Confirm a QRIS payment ```js stripe .confirmQrisPayment('{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: { billing_details: { name: 'Jenny Rosen', }, }, // Return URL where the customer should be redirected after the authorization. return_url: window.location.href, }) .then(function(result) { if (result.error) { // Inform the customer that there was an error. } }); ``` ```es_next const {error} = await stripe.confirmQrisPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: { billing_details: { name: 'Jenny Rosen', }, }, // Return URL where the customer should be redirected after the authorization. return_url: window.location.href, }, ); ``` ## Confirm a SEPA Debit payment Use `stripe.confirmSepaDebitPayment` in the [SEPA Direct Debit Payments](/payments/sepa-debit.md) with Payment Methods flow when the customer submits your payment form. When called, it will confirm the [PaymentIntent](/api/payment_intents.md) with `data` you provide. Note that there are some additional requirements to this flow that are not covered in this reference. Refer to our [integration guide](/payments/sepa-debit.md) for more details. When you confirm a `PaymentIntent`, it needs to have an attached [PaymentMethod](/api/payment_methods.md). In addition to confirming the `PaymentIntent`, this method can automatically create and attach a new PaymentMethod for you. If you have already attached a `PaymentMethod` you can call this method without needing to provide any additional data. These use cases are detailed in the sections that follow. > Note that `stripe.confirmSepaDebitPayment` may take several seconds to complete. > During that time, you should disable your form from being resubmitted and show a waiting indicator like a spinner. > If you receive an error result, you should be sure to show that error to the customer, re-enable the form, and hide the waiting indicator. `stripe.confirmSepaDebitPayment` will return a `Promise` which resolves with a result object. This object has either: * `result.paymentIntent`: the successful PaymentIntent. * `result.error`: an error. Refer to the API reference for all possible errors. **Syntax:** `stripe.confirmSepaDebitPayment(...)` - `clientSecret` (string) **required** The [client secret](/api/payment_intents/object.md#payment_intent_object-client_secret) of the `PaymentIntent`. - `data` (object) Data to be sent with the request. Refer to the [Payment Intents API](/api/payment_intents/confirm.md) for a full list of parameters. - `payment_method` (object | string) The `id` of an existing PaymentMethod or an object of collected data. See use cases below for details. - `setup_future_usage` (string) To set up the SEPA Direct Debit account for reuse, set this parameter to `off_session`. SEPA Direct Debit only accepts an `off_session` value for this parameter. If a `customer` is provided on this [PaymentIntent](/api/payment_intents.md), the [PaymentMethod](/api/payment_methods.md) will be attached to the customer when the PaymentIntent transitions to `processing`. ### Use case: with payment data from an Element Create and attach a new PaymentMethod with `stripe.confirmSepaDebitPayment` by passing an `iban` [Element](/js/element.md) to `payment_method[sepa_debit]`. The new `PaymentMethod` will be created with the data collected by the `Element` and will be used to confirm the `PaymentIntent`. Additionally, to create a SEPA Direct Debit `PaymentMethod`, you are required to collect and include the customer’s name and email address. ### Data argument properties - `payment_method` (object) **required** Pass an `object` to confirm the payment using data collected by an `iban` [Element](/js/element.md). - `sepa_debit` (Element) **required** An `iban` Element. - `billing_details` (Object) **required** The customer's [billing_details](/api/payment_methods/create.md#create_payment_method-billing_details). `name` and `email` are required. - `name` (string) **required** The customer's name. - `email` (string) **required** The customer's email. ### Confirm with an Element ```js stripe .confirmSepaDebitPayment('{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: { sepa_debit: ibanElement, billing_details: { name: 'Jenny Rosen', email: 'jenny@example.com', }, }, }) .then(function(result) { // Handle result.error or result.paymentIntent }); ``` ```es_next const {paymentIntent, error} = await stripe.confirmSepaDebitPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: { sepa_debit: ibanElement, billing_details: { name: 'Jenny Rosen', email: 'jenny@example.com', }, }, }, ); ``` ### Use case: with self collected data If you already know the customer’s IBAN account number or want to collect it yourself, then you do not need to use the `iban` Element with `stripe.confirmSepaDebitPayment`. You can pass in the customer’s account number directly to create a new `PaymentMethod` and confirm the `PaymentIntent`. To create a SEPA Direct Debit `PaymentMethod`, you are required to collect and include the customer’s name and email address. ### Data argument properties - `payment_method` (object) **required** Pass an object to confirm using data collected without an `Element`. - `sepa_debit` (object) **required** - `iban` (string) **required** An IBAN account number. - `billing_details` (Object) **required** The customer's [billing_details](/api/payment_methods/create.md#create_payment_method-billing_details). `name` and `email` are required. - `name` (string) **required** The customer's name. - `email` (string) **required** The customer's email. ### Confirm with self collected data ```js stripe .confirmSepaDebitPayment('{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: { sepa_debit: { iban: 'DE89370400440532013000', }, billing_details: { name: 'Jenny Rosen', email: 'jenny@example.com', }, }, }) .then(function(result) { // Handle result.error or result.paymentIntent }); ``` ```es_next const {paymentIntent, error} = await stripe.confirmSepaDebitPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: { sepa_debit: { iban: 'DE89370400440532013000', }, billing_details: { name: 'Jenny Rosen', email: 'jenny@example.com', }, }, }, ); ``` ### Use case: with an existing payment method If you have already created a `PaymentMethod`, you can pass its `id` to `payment_method` when calling `stripe.confirmSepaDebitPayment`. It will be used to confirm the `PaymentIntent`. ### Data argument properties - `payment_method` (string) **required** The `id` of an existing [PaymentMethod](/api/payment_methods.md). ### Confirm with existing payment method ```js stripe .confirmSepaDebitPayment('{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: '{PAYMENT_METHOD_ID}', }) .then(function(result) { // Handle result.error or result.paymentIntent }); ``` ```es_next const {paymentIntent, error} = await stripe.confirmSepaDebitPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: '{PAYMENT_METHOD_ID}', }, ); ``` ### Use case: with an attached PaymentMethod If you have already attached a `PaymentMethod` to this `PaymentIntent`, then you can confirm the `PaymentIntent` using `stripe.confirmSepaDebitPayment` without passing in any additional data. ### Confirm with an attached PaymentMethod ```js stripe .confirmSepaDebitPayment('{PAYMENT_INTENT_CLIENT_SECRET}') .then(function(result) { // Handle result.error or result.paymentIntent }); ``` ```es_next const {paymentIntent, error} = await stripe.confirmSepaDebitPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', ); ``` ### Confirm a SEPA Debit payment ```js stripe .confirmSepaDebitPayment('{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: { sepa_debit: ibanElement, billing_details: { name: 'Jenny Rosen', email: 'jenny@example.com', }, }, }) .then(function(result) { // Handle result.error or result.paymentIntent }); ``` ```es_next const {paymentIntent, error} = await stripe.confirmSepaDebitPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: { sepa_debit: ibanElement, billing_details: { name: 'Jenny Rosen', email: 'jenny@example.com', }, }, }, ); ``` ## Confirm a ShopeePay payment Use `stripe.confirmShopeePayPayment` in the [ShopeePay Payments with Payment Methods](/payments/shopeepay/accept-a-payment.md) flow when the customer submits your payment form. When called, it will confirm the `PaymentIntent` with `data` you provide, and it will automatically redirect the customer to authorize the transaction. Once authorization is complete, the customer will be redirected back to your specified `return_url`. When you confirm a `PaymentIntent`, it needs to have an attached [PaymentMethod](/api/payment_methods.md). In addition to confirming the `PaymentIntent`, this method can automatically create and attach a new `PaymentMethod` for you. If you have already attached a `PaymentMethod` you can call this method without needing to provide any additional data. These use cases are detailed in the sections that follow. > Note that `stripe.confirmShopeePayPayment` may take several seconds to complete. > During that time, you should disable your form from being resubmitted and show a waiting indicator like a spinner. > If you receive an error result, you should be sure to show that error to the customer, re-enable the form, and hide the waiting indicator. `stripe.confirmShopeePayPayment` will trigger a redirect when successful. If there is an error, it will return a `Promise` which resolves with a `result` object. This object has either: * `result.paymentIntent`: the successful [PaymentIntent](/api/payment_intents). * `result.error`: an error. Refer to the [API reference](/api/errors) for all possible errors. **Syntax:** `stripe.confirmShopeePayPayment(...)` - `clientSecret` (string) **required** The [client secret](/api/payment_intents/object.md#payment_intent_object-client_secret) of the `PaymentIntent`. - `data` (object) Data to be sent with the request. Refer to the [Payment Intents API](/api/payment_intents/confirm.md) for a full list of parameters. - `payment_method` (string | object) Either the `id` of an existing [PaymentMethod](/api/payment_methods.md), or an object containing data to create a `PaymentMethod` with. See the use case sections below for details. - `return_url` (string) The url your customer will be directed to after they complete authentication. - `options` (object) An options object to control the behavior of this method. - `handleActions` (boolean) Set this to `false` if you want to [manually handle the authorization redirect](/payments/shopeepay/accept-a-payment?platform=web.md#handle-redirect). Default is `true`. ### Use case: with an existing payment method Use `stripe.confirmShopeePayPayment` with an existing `PaymentMethod` by passing its `id` to `payment_method`. The `PaymentMethod` will be used to confirm the `PaymentIntent`. ### Data argument properties - `payment_method` (string) **required** The `id` of an existing `PaymentMethod`. - `return_url` (string) The url your customer will be directed to after they complete authentication. ### Confirm with existing payment method ```js stripe .confirmShopeePayPayment('{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: '{PAYMENT_METHOD_ID}', // Return URL where the customer should be redirected after the authorization. return_url: window.location.href, }) .then(function(result) { // Inform the customer that there was an error. }); ``` ```es_next const {error} = await stripe.confirmShopeePayPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: '{PAYMENT_METHOD_ID}', // Return URL where the customer should be redirected after the authorization. return_url: window.location.href, }, ); ``` ### Use case: with collected data Your customer's name is required for the ShopeePay authorization to succeed. You can pass in the customer’s name directly to create a new `PaymentMethod` and confirm the `PaymentIntent`. ### Data argument properties - `payment_method` (object) **required** Pass an object to confirm with the customer's name. - `billing_details` (object) **required** An object detailing billing information. - `name` (string) **required** The customer's name. - `return_url` (string) The url your customer will be directed to after they complete authentication. ### Confirm with self collected data ```js stripe .confirmShopeePayPayment('{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: { billing_details: { name: 'Jenny Rosen', }, }, // Return URL where the customer should be redirected after the authorization. return_url: window.location.href, }) .then(function(result) { if (result.error) { // Inform the customer that there was an error. } }); ``` ```es_next const {error} = await stripe.confirmShopeePayPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: { billing_details: { name: 'Jenny Rosen', }, }, // Return URL where the customer should be redirected after the authorization. return_url: window.location.href, }, ); ``` ### Use case: with an attached PaymentMethod If you have already attached a `PaymentMethod` to this `PaymentIntent`, then you can confirm the `PaymentIntent` using `stripe.confirmShopeePayPayment` without passing in any additional data. ### Confirm with an attached PaymentMethod ```js stripe .confirmShopeePayPayment('{PAYMENT_INTENT_CLIENT_SECRET}') .then(function(result) { // Handle result.error or result.paymentIntent }); ``` ```es_next const {paymentIntent, error} = await stripe.confirmShopeePayPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', ); ``` ### Confirm a ShopeePay payment ```js stripe .confirmShopeePayPayment('{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: { billing_details: { name: 'Jenny Rosen', }, }, // Return URL where the customer should be redirected after the authorization. return_url: window.location.href, }) .then(function(result) { if (result.error) { // Inform the customer that there was an error. } }); ``` ```es_next const {error} = await stripe.confirmShopeePayPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: { billing_details: { name: 'Jenny Rosen', }, }, // Return URL where the customer should be redirected after the authorization. return_url: window.location.href, }, ); ``` ## Confirm a Sofort payment Use `stripe.confirmSofortPayment` in the [Sofort Payments with Payment Methods](/payments/sofort.md) flow when the customer submits your payment form. When called, it will confirm the `PaymentIntent` with `data` you provide. It will then automatically redirect the customer to authorize the transaction. Once authorization is complete, the customer will be redirected back to your specified `return_url`. When you confirm a `PaymentIntent`, it needs to have an attached [PaymentMethod](/api/payment_methods.md). In addition to confirming the `PaymentIntent`, this method can automatically create and attach a new `PaymentMethod` for you. If you have already attached a `PaymentMethod` you can call this method without needing to provide any additional data. These use cases are detailed in the sections that follow. > Note that `stripe.confirmSofortPayment` may take several seconds to complete. > During that time, you should disable your form from being resubmitted and show a waiting indicator like a spinner. > If you receive an error result, you should be sure to show that error to the customer, re-enable the form, and hide the waiting indicator. `stripe.confirmSofortPayment` will trigger a redirect when successful. If there is an error, it will return a `Promise` which resolves with a `result` object. This object has either: * `result.paymentIntent`: the successful [PaymentIntent](/api/payment_intents). * `result.error`: an error. Refer to the [API reference](/api#errors) for all possible errors. **Syntax:** `stripe.confirmSofortPayment(...)` - `clientSecret` (string) **required** The [client secret](/api/payment_intents/object.md#payment_intent_object-client_secret) of the `PaymentIntent`. - `data` (object) Data to be sent with the request. Refer to the [Payment Intents API](/api/payment_intents/confirm.md) for a full list of parameters. - `payment_method` (string | object) Either the `id` of an existing [PaymentMethod](/api/payment_methods.md), or an object containing data to create a `PaymentMethod` with. See the use case sections below for details. - `return_url` (string) The url your customer will be directed to after they complete authentication. - `setup_future_usage` (string) To set up a SEPA Direct Debit payment method using the bank details from this SOFORT payment, set this parameter to `off_session`. When using this parameter, a `customer` will need to be set on the [PaymentIntent](/api/payment_intents.md). The newly created SEPA Direct Debit [PaymentMethod](/api/payment_methods.md) will be attached to this customer. - `options` (object) An options object to control the behavior of this method. - `handleActions` (boolean) Set this to `false` if you want to [manually handle the authorization redirect](/payments/sofort/accept-a-payment?platform=web.md#handle-redirect). Default is `true`. ### Use case: with an existing payment method Use `stripe.confirmSofortPayment` with an existing `PaymentMethod` by passing its `id` to `payment_method`. The `PaymentMethod` will be used to confirm the `PaymentIntent`. ### Data argument properties - `payment_method` (string) **required** The `id` of an existing `PaymentMethod`. - `return_url` (string) The url your customer will be directed to after they complete authentication. - `setup_future_usage` (string) To set up a SEPA Direct Debit payment method using the bank details from this SOFORT payment, set this parameter to `off_session`. When using this parameter, a `customer` will need to be set on the [PaymentIntent](/api/payment_intents.md). The newly created SEPA Direct Debit [PaymentMethod](/api/payment_methods.md) will be attached to this customer. ### Confirm with existing payment method ```js stripe .confirmSofortPayment('{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: '{PAYMENT_METHOD_ID}', // Return URL where the customer should be redirected after the authorization. return_url: window.location.href, }) .then(function(result) { // Inform the customer that there was an error. }); ``` ```es_next const {error} = await stripe.confirmSofortPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: '{PAYMENT_METHOD_ID}', // Return URL where the customer should be redirected after the authorization. return_url: window.location.href, }, ); ``` ### Use case: with collected data The country of your customer's bank is required for the Sofort authorization to succeed. You can pass in the country of your customer's bank directly to create a new `PaymentMethod` and confirm the `PaymentIntent`. ### Data argument properties - `payment_method` (object) **required** Pass an object to confirm with the customer's name. - `sofort` (object) **required** An object detailing SOFORT specific parameters. - `country` (string) **required** The country code where customer's bank is located. - `billing_details` (object) The customer's [billing_details](/api/payment_methods/create.md#create_payment_method-billing_details). Required when `setup_future_usage` is set to `off_session`. - `name` (string) The customer's name. - `email` (string) The customer's email. - `return_url` (string) The url your customer will be directed to after they complete authentication. - `setup_future_usage` (string) To set up a SEPA Direct Debit payment method using the bank details from this SOFORT payment, set this parameter to `off_session`. When using this parameter, a `customer` will need to be set on the [PaymentIntent](/api/payment_intents.md). The newly created SEPA Direct Debit [PaymentMethod](/api/payment_methods.md) will be attached to this customer. ### Confirm with self collected data ```js stripe .confirmSofortPayment('{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: { sofort: { country: 'DE' } }, // Return URL where the customer should be redirected after the authorization. return_url: window.location.href, }) .then(function(result) { if (result.error) { // Inform the customer that there was an error. } }); ``` ```es_next const {error} = await stripe.confirmSofortPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: { sofort: { country: 'DE' } }, // Return URL where the customer should be redirected after the authorization. return_url: window.location.href, }, ); ``` ### Use case: with an attached PaymentMethod If you have already attached a `PaymentMethod` to this `PaymentIntent`, then you can confirm the `PaymentIntent` using `stripe.confirmSofortPayment` without passing in any additional data. ### Confirm with an attached PaymentMethod ```js stripe .confirmSofortPayment('{PAYMENT_INTENT_CLIENT_SECRET}') .then(function(result) { // Handle result.error or result.paymentIntent }); ``` ```es_next const {paymentIntent, error} = await stripe.confirmSofortPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', ); ``` ### Confirm a Sofort payment ```js stripe .confirmSofortPayment('{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: { sofort: { country: 'DE' } }, // Return URL where the customer should be redirected after the authorization. return_url: window.location.href, }) .then(function(result) { if (result.error) { // Inform the customer that there was an error. } }); ``` ```es_next const {error} = await stripe.confirmSofortPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: { sofort: { country: 'DE' } }, // Return URL where the customer should be redirected after the authorization. return_url: window.location.href, }, ); ``` ## Confirm a South Korea Market payment Use `stripe.confirmSouthKoreaMarketPayment` in the South Korea Market payment method creation flow when the customer submits your payment form. When you call the method, it confirms the [PaymentIntent](/api/payment_intents.md) with the `data` you provide, and automatically redirects the customer to authorize the transaction. Once authorization is complete, the customer is redirected back to your specified `return_url`. When you confirm a `PaymentIntent`, it needs to have an attached [PaymentMethod](/api/payment_methods.md). In addition to confirming the `PaymentIntent`, this method can automatically create and attach a new `PaymentMethod` for you. If you've already attached a `return_url` and a `PaymentMethod`, you can call this method without needing to provide any additional data. These use cases are detailed in the sections that follow. > Note that `stripe.confirmSouthKoreaMarketPayment` might take several seconds to complete. > During that time, you should disable your form from being resubmitted and show a waiting indicator like a spinner. > If you receive an error result, show that error to the customer, re-enable the form, and hide the waiting indicator. By default, `stripe.confirmSouthKoreaMarketPayment` triggers a redirect when successful. If there's an error, or when handling `next_action`s manually by using the `handleActions: false` option, it returns a `Promise` which resolves with a `result` object. This object has either: * `result.paymentIntent`: the successful [PaymentIntent](/api/payment_intents). * `result.error`: an error. Refer to the [API reference](/api/errors) for all possible errors. **Syntax:** `stripe.confirmSouthKoreaMarketPayment(...)` - `clientSecret` (string) **required** The [client secret](/api/payment_intents/object.md#payment_intent_object-client_secret) of the `PaymentIntent`. - `data` (object) Data to be sent with the request. Refer to the [Payment Intents API](/api/payment_intents/confirm.md) for a full list of parameters. - `payment_method` (string | object) Either the `id` of an existing [PaymentMethod](/api/payment_methods.md), or an object containing data to create a `PaymentMethod` with. See the use case sections below for details. - `return_url` (string) **required** The url your customer will be directed to after they complete authentication. - `options` (object) An options object to control the behavior of this method. - `handleActions` (boolean) Set this to `false` if you want to [manually handle the authorization redirect](/payments/south-korea-market/accept-a-payment.md#handle-redirect). Default is `true`. ### Use case: without an existing payment method If you haven't already created a `PaymentMethod`, you can pass payment method parameters, and the newly created `PaymentMethod` is used to confirm the `PaymentIntent`. ### Data argument properties - `payment_method` (object) **required** Pass payment method billing details. - `billing_details` (object) **required** The [billing_details](/api/payment_methods/create.md#create_payment_method-billing_details) associated with the payment. - `email` (string) **required** - `name` (string) **required** - `address` (object) **required** - `shipping` (object) The [shipping details](/api/payment_intents/confirm.md#confirm_payment_intent-shipping) for the payment. - `name` (string) **required** - `address` (object) **required** - `return_url` (string) **required** The url your customer will be directed to after they complete authentication. ### Confirm without existing payment method ```js stripe.confirmSouthKoreaMarketPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: { billing_details: { name: 'Jenny Rosen', email: 'jenny@example.com', address: { line1: '123 Main Street', city: 'San Francisco', state: 'CA', country: 'US', postal_code: '94321' } } }, shipping: { name: 'Jenny Rosen', address: { line1: '123 Main Street', city: 'San Francisco', state: 'CA', country: 'US', postal_code: '94321' } }, // Return URL where the customer should be redirected after the authorization. return_url: window.location.href } ).then(function(result) { if (result.error) { // Inform the customer that there was an error. } }); ``` ```es_next const {error} = await stripe.confirmSouthKoreaMarketPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: { billing_details: { name: 'Jenny Rosen', email: 'jenny@example.com', address: { line1: '123 Main Street', city: 'San Francisco', state: 'CA', country: 'US', postal_code: '94321' } } }, shipping: { name: 'Jenny Rosen', address: { line1: '123 Main Street', city: 'San Francisco', state: 'CA', country: 'US', postal_code: '94321' } }, // Return URL where the customer should be redirected after the authorization. return_url: window.location.href } ); ``` ### Use case: with an existing payment method If you've already created a `PaymentMethod`, you can pass its `id` to `payment_method`, which is used to confirm the `PaymentIntent`. ### Data argument properties - `payment_method` (string) **required** The `id` of an existing `PaymentMethod`. - `return_url` (string) **required** The url your customer will be directed to after they complete authentication. ### Confirm with existing payment method ```js stripe.confirmSouthKoreaMarketPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: '{PAYMENT_METHOD_ID}', // Return URL where the customer should be redirected after the authorization. return_url: window.location.href } ).then(function(result) { // Inform the customer that there was an error. }); ``` ```es_next const {error} = await stripe.confirmSouthKoreaMarketPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: '{PAYMENT_METHOD_ID}', // Return URL where the customer should be redirected after the authorization. return_url: window.location.href } ); ``` ### Use case: with an attached PaymentMethod If you've already attached a `return_url` and a `PaymentMethod` to this `PaymentIntent`, you can confirm it without passing in any additional data. ### Confirm with an attached PaymentMethod ```js stripe.confirmSouthKoreaMarketPayment( '{PAYMENT_INTENT_CLIENT_SECRET}' ).then(function(result) { if (result.error) { // Inform the customer that there was an error. } }); ``` ```es_next const {error} = await stripe.confirmSouthKoreaMarketPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', ); ``` ### Confirm an South Korea Market payment ```js stripe.confirmSouthKoreaMarketPayment( '{PAYMENT_INTENT_CLIENT_SECRET}' ).then(function(result) { if (result.error) { // Inform the customer that there was an error. } }); ``` ```es_next const {error} = await stripe.confirmSouthKoreaMarketPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', ); ``` ## Confirm a Sunbit payment Use `stripe.confirmSunbitPayment` in the [Sunbit Payments](/payments/sunbit/accept-a-payment.md) flow when the customer submits your payment form. When called, it will confirm the [PaymentIntent](/api/payment_intents.md) with `data` you provide, and it will automatically redirect the customer to authorize the transaction. Once authorization is complete, the customer will be redirected back to your specified `return_url`. When you confirm a `PaymentIntent`, it needs to have an attached [PaymentMethod](/api/payment_methods.md). In addition to confirming the `PaymentIntent`, this method can automatically create and attach a new `PaymentMethod` for you. If you have already attached a `PaymentMethod` you can call this method without needing to provide any additional data. These use cases are detailed in the sections that follow. > Note that `stripe.confirmSunbitPayment` may take several seconds to complete. > During that time, you should disable your form from being resubmitted and show a waiting indicator like a spinner. > If you receive an error result, you should be sure to show that error to the customer, re-enable the form, and hide the waiting indicator. By default, `stripe.confirmSunbitPayment` will trigger a redirect when successful. If there is an error, or when handling `next_action`s manually by using the `handleActions: false` option, it will return a `Promise` which resolves with a `result` object. This object has either: * `result.paymentIntent`: the successful [PaymentIntent](/api/payment_intents). * `result.error`: an error. Refer to the [API reference](/api/errors) for all possible errors. **Syntax:** `stripe.confirmSunbitPayment(...)` - `clientSecret` (string) **required** The [client secret](/api/payment_intents/object.md#payment_intent_object-client_secret) of the `PaymentIntent`. - `data` (object) Data to be sent with the request. Refer to the [Payment Intents API](/api/payment_intents/confirm.md) for a full list of parameters. - `payment_method` (string | object) Either the `id` of an existing [PaymentMethod](/api/payment_methods.md), or an object containing data to create a `PaymentMethod` with. See the use case sections below for details. - `return_url` (string) **required** The url your customer will be directed to after they complete authentication. - `options` (object) An options object to control the behavior of this method. - `handleActions` (boolean) Set this to `false` if you want to [manually handle the authorization redirect](/payments/sunbit/accept-a-payment.md#handle-redirect). Default is `true`. ### Use case: without an existing payment method If you have not already created a `PaymentMethod`, you can pass payment method parameters, and the newly created `PaymentMethod` will be used to confirm the `PaymentIntent`. ### Data argument properties - `payment_method` (object) **required** Pass payment method billing details. - `billing_details` (object) **required** The [billing_details](/api/payment_methods/create.md#create_payment_method-billing_details) associated with the payment. - `email` (string) **required** - `name` (string) **required** - `address` (object) **required** - `return_url` (string) **required** The url your customer will be directed to after they complete authentication. ### Confirm without existing payment method ```js stripe.confirmSunbitPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: { billing_details: { name: 'Jenny Rosen', email: 'jenny@example.com', address: { line1: '123 Main Street', city: 'San Francisco', state: 'CA', country: 'US', postal_code: '94321' } } }, // Return URL where the customer should be redirected after the authorization. return_url: window.location.href } ).then(function(result) { if (result.error) { // Inform the customer that there was an error. } }); ``` ```es_next const {error} = await stripe.confirmSunbitPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: { billing_details: { name: 'Jenny Rosen', email: 'jenny@example.com', address: { line1: '123 Main Street', city: 'San Francisco', state: 'CA', country: 'US', postal_code: '94321' } } }, // Return URL where the customer should be redirected after the authorization. return_url: window.location.href } ); ``` ### Use case: with an existing payment method If you have already created a `PaymentMethod`, you can pass its `id` to `payment_method` and it will be used to confirm the `PaymentIntent`. ### Data argument properties - `payment_method` (string) **required** The `id` of an existing `PaymentMethod`. - `return_url` (string) **required** The url your customer will be directed to after they complete authentication. ### Confirm with existing payment method ```js stripe.confirmSunbitPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: '{PAYMENT_METHOD_ID}', // Return URL where the customer should be redirected after the authorization. return_url: window.location.href } ).then(function(result) { // Inform the customer that there was an error. }); ``` ```es_next const {error} = await stripe.confirmSunbitPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: '{PAYMENT_METHOD_ID}', // Return URL where the customer should be redirected after the authorization. return_url: window.location.href } ); ``` ### Use case: with an attached PaymentMethod If you have already attached a `return_url` and a `PaymentMethod` to this `PaymentIntent`, then you can confirm without passing in any additional data. ### Confirm with an attached PaymentMethod ```js stripe.confirmSunbitPayment( '{PAYMENT_INTENT_CLIENT_SECRET}' ).then(function(result) { if (result.error) { // Inform the customer that there was an error. } }); ``` ```es_next const {error} = await stripe.confirmSunbitPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', ); ``` ### Confirm a Sunbit payment ```js stripe.confirmSunbitPayment( '{PAYMENT_INTENT_CLIENT_SECRET}' ).then(function(result) { if (result.error) { // Inform the customer that there was an error. } }); ``` ```es_next const {error} = await stripe.confirmSunbitPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', ); ``` ## Confirm a TWINT payment Use `stripe.confirmTwintPayment` in the TWINT payment method creation flow when the customer submits your payment form. When you call the method, it confirms the [PaymentIntent](/api/payment_intents.md) with the `data` you provide, and automatically redirects the customer to authorize the transaction. Once authorization is complete, the customer is redirected back to your specified `return_url`. When you confirm a `PaymentIntent`, it needs to have an attached [PaymentMethod](/api/payment_methods.md). In addition to confirming the `PaymentIntent`, this method can automatically create and attach a new `PaymentMethod` for you. If you've already attached a `return_url` and a `PaymentMethod`, you can call this method without needing to provide any additional data. These use cases are detailed in the sections that follow. > Note that `stripe.confirmTwintPayment` might take several seconds to complete. > During that time, you should disable your form from being resubmitted and show a waiting indicator like a spinner. > If you receive an error result, show that error to the customer, re-enable the form, and hide the waiting indicator. By default, `stripe.confirmTwintPayment` triggers a redirect when successful. If there's an error, or when handling `next_action`s manually by using the `handleActions: false` option, it returns a `Promise` which resolves with a `result` object. This object has either: * `result.paymentIntent`: the successful [PaymentIntent](/api/payment_intents). * `result.error`: an error. Refer to the [API reference](/api/errors) for all possible errors. **Syntax:** `stripe.confirmTwintPayment(...)` - `clientSecret` (string) **required** The [client secret](/api/payment_intents/object.md#payment_intent_object-client_secret) of the `PaymentIntent`. - `data` (object) Data to be sent with the request. Refer to the [Payment Intents API](/api/payment_intents/confirm.md) for a full list of parameters. - `payment_method` (string | object) Either the `id` of an existing [PaymentMethod](/api/payment_methods.md), or an object containing data to create a `PaymentMethod` with. See the use case sections below for details. - `return_url` (string) **required** The url your customer will be directed to after they complete authentication. - `options` (object) An options object to control the behavior of this method. - `handleActions` (boolean) Set this to `false` if you want to [manually handle the authorization redirect](/payments/twint/accept-a-payment.md#handle-redirect). Default is `true`. ### Use case: without an existing payment method If you haven't already created a `PaymentMethod`, you can pass payment method parameters, and the newly created `PaymentMethod` is used to confirm the `PaymentIntent`. ### Data argument properties - `payment_method` (object) **required** Pass payment method billing details. - `billing_details` (object) **required** The [billing_details](/api/payment_methods/create.md#create_payment_method-billing_details) associated with the payment. - `email` (string) **required** - `name` (string) **required** - `address` (object) **required** - `shipping` (object) The [shipping details](/api/payment_intents/confirm.md#confirm_payment_intent-shipping) for the payment. - `name` (string) **required** - `address` (object) **required** - `return_url` (string) **required** The url your customer will be directed to after they complete authentication. ### Confirm without existing payment method ```js stripe.confirmTwintPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: { billing_details: { name: 'Jenny Rosen', email: 'jenny@example.com', address: { line1: '123 Main Street', city: 'San Francisco', state: 'CA', country: 'US', postal_code: '94321' } } }, shipping: { name: 'Jenny Rosen', address: { line1: '123 Main Street', city: 'San Francisco', state: 'CA', country: 'US', postal_code: '94321' } }, // Return URL where the customer should be redirected after the authorization. return_url: window.location.href } ).then(function(result) { if (result.error) { // Inform the customer that there was an error. } }); ``` ```es_next const {error} = await stripe.confirmTwintPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: { billing_details: { name: 'Jenny Rosen', email: 'jenny@example.com', address: { line1: '123 Main Street', city: 'San Francisco', state: 'CA', country: 'US', postal_code: '94321' } } }, shipping: { name: 'Jenny Rosen', address: { line1: '123 Main Street', city: 'San Francisco', state: 'CA', country: 'US', postal_code: '94321' } }, // Return URL where the customer should be redirected after the authorization. return_url: window.location.href } ); ``` ### Use case: with an existing payment method If you've already created a `PaymentMethod`, you can pass its `id` to `payment_method`, which is used to confirm the `PaymentIntent`. ### Data argument properties - `payment_method` (string) **required** The `id` of an existing `PaymentMethod`. - `return_url` (string) **required** The url your customer will be directed to after they complete authentication. ### Confirm with existing payment method ```js stripe.confirmTwintPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: '{PAYMENT_METHOD_ID}', // Return URL where the customer should be redirected after the authorization. return_url: window.location.href } ).then(function(result) { // Inform the customer that there was an error. }); ``` ```es_next const {error} = await stripe.confirmTwintPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: '{PAYMENT_METHOD_ID}', // Return URL where the customer should be redirected after the authorization. return_url: window.location.href } ); ``` ### Use case: with an attached PaymentMethod If you've already attached a `return_url` and a `PaymentMethod` to this `PaymentIntent`, you can confirm it without passing in any additional data. ### Confirm with an attached PaymentMethod ```js stripe.confirmTwintPayment( '{PAYMENT_INTENT_CLIENT_SECRET}' ).then(function(result) { if (result.error) { // Inform the customer that there was an error. } }); ``` ```es_next const {error} = await stripe.confirmTwintPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', ); ``` ### Confirm an TWINT payment ```js stripe.confirmTwintPayment( '{PAYMENT_INTENT_CLIENT_SECRET}' ).then(function(result) { if (result.error) { // Inform the customer that there was an error. } }); ``` ```es_next const {error} = await stripe.confirmTwintPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', ); ``` ## Confirm a UPI payment Use `stripe.confirmUpiPayment` when customer submits your payment form. When called, it will confirm the [PaymentIntent](/api/payment_intents.md), and return a `Promise` which resolves with the PaymentIntent having its final payment status. Since the authentication for UPI payments happen on customer's mobile device, and the timeout for such authentication is 5 minutes, the `Promise` returned by `stripe.confirmUpiPayment` can take upto 5 minutes to resolve. We recommend showing an appropriate message to the customer indicating their payment is being processed. > Note that `stripe.confirmUpiPayment` may take several minutes to complete. > During that time, you should disable your form from being resubmitted and show a waiting > indicator like a spinner. If you receive an error result, you should be sure to show that > error to the customer, re-enable the form, and hide the waiting indicator. By default, `stripe.confirmUpiPayment` will return a `Promise` which resolves with the [PaymentIntent](/api/payment_intents). If there is an error, or when handling next actions manually by using the `handleActions: false` option, it will return a `Promise` which resolves with a `result` object. This object has either: * `result.paymentIntent`: the successful [PaymentIntent](/api/payment_intents). * `result.error`: an error. Refer to the [API reference](/api/errors) for all possible errors. **Syntax:** `stripe.confirmUpiPayment(...)` - `clientSecret` (string) **required** The [client secret](/api/payment_intents/object.md#payment_intent_object-client_secret) of the `PaymentIntent`. - `data` (object) Data to be sent with the request. Refer to the [Payment Intents API](/api/payment_intents/confirm.md) for a full list of parameters. - `payment_method` (string | object) Either the `id` of an existing [PaymentMethod](/api/payment_methods.md), or an object containing data to create a `PaymentMethod` with. See the use case sections below for details. - `options` (object) An options object to control the behavior of this method. - `handleActions` (boolean) Set this to `false` if you want to manually poll for the [PaymentIntent status](/api/payment_intents/retrieve.md). Default is `true`. ### Use case: with self collected data If you already know the customer's VPA or have collected it, then you can pass it directly. This will automatically create a new `PaymentMethod`. ### Data argument properties - `vpa` (string) **required** VPA of the customer using which the payment needs to be authenticated. ### Confirm with self collected data ```js stripe .confirmUpiPayment('{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: { upi: { vpa: 'stripe@upi' } } }) .then(function(result) { if (result.error) { // Inform the customer that there was an error. } else{ // Inform the customer the status of their payment. } }); ``` ```es_next const {error} = await stripe.confirmUpiyPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: { upi: { vpa: 'stripe@upi' } } }, ); ``` ### Use case: with an attached PaymentMethod If you have already attached a `PaymentMethod` to this `PaymentIntent`, you can then confirm the `PaymentIntent` using `stripe.confirmUpiPayment` without passing in any additional data. ### Confirm with an attached PaymentMethod ```js stripe .confirmUpiPayment('{PAYMENT_INTENT_CLIENT_SECRET}') .then(function(result) { if (result.error) { // Inform the customer that there was an error. } else{ // Inform the customer the status of their payment. } }); ``` ```es_next const {error} = await stripe.confirmUpiPayment('{PAYMENT_INTENT_CLIENT_SECRET}'); ``` ### Confirm a UPI payment ```js stripe .confirmUpiPayment('{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: { upi: { vpa: 'stripe@upi' } } }) .then(function(result) { if (result.error) { // Inform the customer that there was an error. } else{ // Inform the customer the status of their payment. } }); ``` ```es_next const {error} = await stripe.confirmUpiyPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: { upi: { vpa: 'stripe@upi' } } }, ); ``` ## Confirm a Netbanking payment Use `stripe.confirmNetbankingPayment` when customer submits your payment form. When called, it will confirm the `PaymentIntent` with `data` you provide, and it will automatically redirect the customer to authenticate the transaction. Once authentication is complete, the customer will be redirected back to your specified `return_url`. When you confirm a `PaymentIntent`, it needs to have an attached [PaymentMethod](/api/payment_methods.md). In addition to confirming the `PaymentIntent`, this method can automatically create and attach a new `PaymentMethod` for you. If you have already attached a `PaymentMethod` you can call this method without needing to provide any additional data. These use cases are detailed in the sections that follow. > Note that `stripe.confirmNetbankingPayment` may take several seconds to complete. > During that time, you should disable your form from being resubmitted and show a waiting indicator like a spinner. > If you receive an error result, you should be sure to show that error to the customer, re-enable the form, and hide the waiting indicator. By default, `stripe.confirmNetbankankingPayment` will trigger a redirect when successful. If there is an error, or when handling `next_action`s manually by using the `handleActions: false` option, it will return a `Promise` which resolves with a `result` object. This object has either: * `result.paymentIntent`: the successful [PaymentIntent](/api/payment_intents). * `result.error`: an error. Refer to the [API reference](/api/errors) for all possible errors. **Syntax:** `stripe.confirmNetbankingPayment(...)` - `clientSecret` (string) **required** The [client secret](/api/payment_intents/object.md#payment_intent_object-client_secret) of the `PaymentIntent`. - `data` (object) Data to be sent with the request. Refer to the [Payment Intents API](/api/payment_intents/confirm.md) for a full list of parameters. - `payment_method` (string | object) Either the `id` of an existing [PaymentMethod](/api/payment_methods.md), or an object containing data to create a `PaymentMethod` with. See the use case sections below for details. - `return_url` (string) The url your customer will be directed to after they complete authentication. - `options` (object) An options object to control the behavior of this method. - `handleActions` (boolean) Set this to `false` if you want to [manually handle the authentication redirect](/payments/netbannaking.md#handle-redirect). Default is `true`. ### Use case: with an existing payment method Use `stripe.confirmNetbankingPayment` with an existing `PaymentMethod` by passing its `id` to `payment_method`. The `PaymentMethod` will be used to confirm the `PaymentIntent`. ### Data argument properties - `payment_method` (string) **required** The `id` of an existing `PaymentMethod`. - `return_url` (string) The url your customer will be directed to after they complete authentication. ### Confirm with existing payment method ```js stripe .confirmNetbankingPayment('{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: '{PAYMENT_METHOD_ID}', // Return URL where the customer should be redirected after the authentication. return_url: window.location.href, }) .then(function(result) { // Inform the customer that there was an error. }); ``` ```es_next const {error} = await stripe.confirmNetbankingPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: '{PAYMENT_METHOD_ID}', // Return URL where the customer should be redirected after the authentication. return_url: window.location.href, }, ); ``` ### Use case: with an attached PaymentMethod If you have already attached a `PaymentMethod` to this `PaymentIntent`, you can then confirm the `PaymentIntent` using `stripe.confirmNetbankingPayment` without passing in any additional data. ### Confirm with an attached PaymentMethod ```js stripe .confirmNetbankingPayment('{PAYMENT_INTENT_CLIENT_SECRET}') .then(function(result) { // Handle result.error or result.paymentIntent }); ``` ```es_next const {paymentIntent, error} = await stripe.confirmNetbankingPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', ); ``` ### Confirm a Netbanking payment ```js stripe .confirmNetbankingPayment('{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: { netbanking: { bank: 'hdfc', }, }, // Return URL where the customer should be redirected after the authentication. return_url: window.location.href, }) .then(function(result) { if (result.error) { // Inform the customer that there was an error. } }); ``` ```es_next const {error} = await stripe.confirmNetbankingPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: { netbanking: { bank: 'hdfc', }, }, // Return URL where the customer should be redirected after the authentication. return_url: window.location.href, }, ); ``` ## Confirm a WeChat Pay payment Use `stripe.confirmWechatPayPayment` in the WeChat Pay payment method creation flow when the customer submits your payment form. When called, it will confirm the [PaymentIntent](/api/payment_intents.md) with `data` you provide and handle the [NextAction](/api/payment_intents/object.md#payment_intent_object-next_action) for the customer to authorize the payment. When you confirm a `PaymentIntent`, it needs to have an attached [PaymentMethod](/api/payment_methods.md). In addition to confirming the `PaymentIntent`, this method can automatically create and attach a new `PaymentMethod` for you. If you have already attached a `PaymentMethod` you can call this method without needing to provide any additional data. These use cases are detailed in the sections that follow. > Note that `stripe.confirmWechatPayPayment` may take several seconds to complete and display the QR code. > During that time, you should disable your form from being resubmitted and show a waiting indicator like a spinner. > If you receive an error result, you should be sure to show that error to the customer, re-enable the form, and hide the waiting indicator. By default, `stripe.confirmWechatPayPayment` will display WeChat Pay QR code. If there is an error, or when handling next actions manually by using the `handleActions: false` option, it will return a `Promise` which resolves with a `result` object. This object has either: * `result.paymentIntent`: the successful [PaymentIntent](/api/payment_intents). * `result.error`: an error. Refer to the [API reference](/api/errors) for all possible errors. **Syntax:** `stripe.confirmWechatPayPayment(...)` - `clientSecret` (string) **required** The [client secret](/api/payment_intents/object.md#payment_intent_object-client_secret) of the `PaymentIntent`. - `data` (object) Data to be sent with the request. Refer to the [Payment Intents API](/api/payment_intents/confirm.md) for a full list of parameters. - `payment_method` (string | object) Either the `id` of an existing [PaymentMethod](/api/payment_methods.md), or an object containing data to create a `PaymentMethod` with. See the use case sections below for details. - `options` (object) An options object to control the behavior of this method. - `handleActions` (boolean) Set this to `false` if you would like to [handle displaying the WeChat Pay QR code yourself](/payments/wechat-pay/accept-a-payment?platform=web.md#submit-payment). ### Use case: Without an existing payment method If you have not already created a `PaymentMethod`, you can pass payment method parameters, and the newly created `PaymentMethod` will be used to confirm the `PaymentIntent`. ### Data argument properties - `payment_method` (object) **required** Pass payment method billing details. - `billing_details` (object) The [billing_details](/api/payment_methods/create.md#create_payment_method-billing_details) associated with the payment method. ### Confirm without existing payment method ```js stripe.confirmWechatPayPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: { billing_details: { name: '{NAME}', email: '{EMAIL}' }, wechat_pay: {}, }, } ).then(function({error, paymentIntent}) { if (error) { // Inform the customer that there was an error. } else if (paymentIntent.status === 'succeeded') { // Inform the customer that the payment was successful } else if (paymentIntent.status === 'requires_action') { // Inform the customer that the payment did not go through } }); ``` ```es_next const {error, paymentIntent} = await stripe.confirmWechatPayPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: { billing_details: { name: '{NAME}', email: '{EMAIL}' }, wechat_pay: {}, }, } ); if (error) { // Inform the customer that there was an error. } else if (paymentIntent.status === 'succeeded') { // Inform the customer that the payment was successful } else if (paymentIntent.status === 'requires_action') { // Inform the customer that the payment did not go through } ``` ### Use case: With an existing payment method If you have already created a `PaymentMethod`, you can pass its `id` to `payment_method` and it will be used to confirm the `PaymentIntent`. ### Data argument properties - `payment_method` (string) **required** The `id` of an existing `PaymentMethod`. ### Confirm with existing payment method ```js stripe.confirmWechatPayPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: '{PAYMENT_METHOD_ID}', } ).then(function({error, paymentIntent}) { if (error) { // Inform the customer that there was an error. } else if (paymentIntent.status === 'succeeded') { // Inform the customer that the payment was successful } else if (paymentIntent.status === 'requires_action') { // Inform the customer that the payment did not go through } }); ``` ```es_next const {error} = await stripe.confirmWechatPayPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: '{PAYMENT_METHOD_ID}', } ); if (error) { // Inform the customer that there was an error. } else if (paymentIntent.status === 'succeeded') { // Inform the customer that the payment was successful } else if (paymentIntent.status === 'requires_action') { // Inform the customer that the payment did not go through } ``` ### Use case: With an attached PaymentMethod If you have already attached a `PaymentMethod` to this `PaymentIntent`, then you can confirm without passing in any additional data. ### Confirm with an attached PaymentMethod ```js stripe.confirmWechatPayPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', {} ).then(function({error, paymentIntent}) { if (error) { // Inform the customer that there was an error. } else if (paymentIntent.status === 'succeeded') { // Inform the customer that the payment was successful } else if (paymentIntent.status === 'requires_action') { // Inform the customer that the payment did not go through } }); ``` ```es_next const {error} = await stripe.confirmWechatPayPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', {} ); if (error) { // Inform the customer that there was an error. } else if (paymentIntent.status === 'succeeded') { // Inform the customer that the payment was successful } else if (paymentIntent.status === 'requires_action') { // Inform the customer that the payment did not go through } ``` ### Confirm a WeChat Pay payment ```js stripe.confirmWechatPayPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', {} ).then(function({error, paymentIntent}) { if (error) { // Inform the customer that there was an error. } else if (paymentIntent.status === 'succeeded') { // Inform the customer that the payment was successful } else if (paymentIntent.status === 'requires_action') { // Inform the customer that the payment did not go through } }); ``` ```es_next const {error} = await stripe.confirmWechatPayPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', {} ); if (error) { // Inform the customer that there was an error. } else if (paymentIntent.status === 'succeeded') { // Inform the customer that the payment was successful } else if (paymentIntent.status === 'requires_action') { // Inform the customer that the payment did not go through } ``` ## Confirm an Zip payment Use `stripe.confirmZipPayment` in the Zip payment method creation flow when the customer submits your payment form. When called, it will confirm the [PaymentIntent](/api/payment_intents.md) with `data` you provide, and it will automatically redirect the customer to authorize the transaction. Once authorization is complete, the customer will be redirected back to your specified `return_url`. When you confirm a `PaymentIntent`, it needs to have an attached [PaymentMethod](/api/payment_methods.md). In addition to confirming the `PaymentIntent`, this method can automatically create and attach a new `PaymentMethod` for you. If you have already attached a `return_url` and a `PaymentMethod` you can call this method without needing to provide any additional data. These use cases are detailed in the sections that follow. > Note that `stripe.confirmZipPayment` may take several seconds to complete. > During that time, you should disable your form from being resubmitted and show a waiting indicator like a spinner. > If you receive an error result, you should be sure to show that error to the customer, re-enable the form, and hide the waiting indicator. By default, `stripe.confirmZipPayment` will trigger a redirect when successful. If there is an error, or when handling `next_action`s manually by using the `handleActions: false` option, it will return a `Promise` which resolves with a `result` object. This object has either: * `result.paymentIntent`: the successful [PaymentIntent](/api/payment_intents). * `result.error`: an error. Refer to the [API reference](/api/errors) for all possible errors. **Syntax:** `stripe.confirmZipPayment(...)` - `clientSecret` (string) **required** The [client secret](/api/payment_intents/object.md#payment_intent_object-client_secret) of the `PaymentIntent`. - `data` (object) Data to be sent with the request. Refer to the [Payment Intents API](/api/payment_intents/confirm.md) for a full list of parameters. - `payment_method` (string | object) Either the `id` of an existing [PaymentMethod](/api/payment_methods.md), or an object containing data to create a `PaymentMethod` with. See the use case sections below for details. - `return_url` (string) **required** The url your customer will be directed to after they complete authentication. - `options` (object) An options object to control the behavior of this method. - `handleActions` (boolean) Set this to `false` if you want to [manually handle the authorization redirect](/payments/zip/accept-a-payment.md#handle-redirect). Default is `true`. ### Use case: without an existing payment method If you have not already created a `PaymentMethod`, you can pass payment method parameters, and the newly created `PaymentMethod` will be used to confirm the `PaymentIntent`. ### Data argument properties - `payment_method` (object) **required** Pass payment method billing details. - `billing_details` (object) **required** The [billing_details](/api/payment_methods/create.md#create_payment_method-billing_details) associated with the payment. - `email` (string) **required** - `name` (string) **required** - `address` (object) **required** - `shipping` (object) The [shipping details](/api/payment_intents/confirm.md#confirm_payment_intent-shipping) for the payment. - `name` (string) **required** - `address` (object) **required** - `return_url` (string) **required** The url your customer will be directed to after they complete authentication. ### Confirm without existing payment method ```js stripe.confirmZipPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: { billing_details: { name: 'Jenny Rosen', email: 'jenny@example.com', address: { line1: '123 Main Street', city: 'San Francisco', state: 'CA', country: 'US', postal_code: '94321' } } }, shipping: { name: 'Jenny Rosen', address: { line1: '123 Main Street', city: 'San Francisco', state: 'CA', country: 'US', postal_code: '94321' } }, // Return URL where the customer should be redirected after the authorization. return_url: window.location.href } ).then(function(result) { if (result.error) { // Inform the customer that there was an error. } }); ``` ```es_next const {error} = await stripe.confirmZipPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: { billing_details: { name: 'Jenny Rosen', email: 'jenny@example.com', address: { line1: '123 Main Street', city: 'San Francisco', state: 'CA', country: 'US', postal_code: '94321' } } }, shipping: { name: 'Jenny Rosen', address: { line1: '123 Main Street', city: 'San Francisco', state: 'CA', country: 'US', postal_code: '94321' } }, // Return URL where the customer should be redirected after the authorization. return_url: window.location.href } ); ``` ### Use case: with an existing payment method If you have already created a `PaymentMethod`, you can pass its `id` to `payment_method` and it will be used to confirm the `PaymentIntent`. ### Data argument properties - `payment_method` (string) **required** The `id` of an existing `PaymentMethod`. - `return_url` (string) **required** The url your customer will be directed to after they complete authentication. ### Confirm with existing payment method ```js stripe.confirmZipPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: '{PAYMENT_METHOD_ID}', // Return URL where the customer should be redirected after the authorization. return_url: window.location.href } ).then(function(result) { // Inform the customer that there was an error. }); ``` ```es_next const {error} = await stripe.confirmZipPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: '{PAYMENT_METHOD_ID}', // Return URL where the customer should be redirected after the authorization. return_url: window.location.href } ); ``` ### Use case: with an attached PaymentMethod If you have already attached a `return_url` and a `PaymentMethod` to this `PaymentIntent`, then you can confirm without passing in any additional data. ### Confirm with an attached PaymentMethod ```js stripe.confirmZipPayment( '{PAYMENT_INTENT_CLIENT_SECRET}' ).then(function(result) { if (result.error) { // Inform the customer that there was an error. } }); ``` ```es_next const {error} = await stripe.confirmZipPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', ); ``` ### Confirm an Zip payment ```js stripe.confirmZipPayment( '{PAYMENT_INTENT_CLIENT_SECRET}' ).then(function(result) { if (result.error) { // Inform the customer that there was an error. } }); ``` ```es_next const {error} = await stripe.confirmZipPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', ); ```