## Setup Intents

Use the [Setup Intents APIs](https://docs.stripe.com/payments/setup-intents.md) to save a card and charge it later.
For step-by-step instructions on using the Setup Intents APIs, see the [set up recurring payments guide](https://docs.stripe.com/payments/save-and-reuse.md).

The following Stripe.js methods are available for working with Setup Intents.

## Confirm a setup

`stripe.confirmSetup(options: object)`

Use `stripe.confirmSetup` to confirm a [SetupIntent](https://docs.stripe.com/api/setup_intents.md) using data collected
by the [Payment Element](https://docs.stripe.com/js/element/payment_element.md), or with manually provided data via `confirmParams`.
When called, `stripe.confirmSetup` will attempt to complete any [required actions](https://docs.stripe.com/payments/intents.md),
such as authenticating your user by displaying a 3DS dialog or redirecting them to a bank authorization page.
Your user will be redirected to the `return_url` you pass once the authorization is complete.

> The `stripe.confirmSetup` 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 result, show this error to the user, re-enable the form, and hide the waiting indicator.

- `options`
    - `elements`
      The [Elements](#payment_element_create) instance used to create the Payment Element.

Required if you [collect payment details before creating an Intent](https://docs.stripe.com/payments/accept-a-payment-deferred.md?platform=web&type=setup). It's always required if you don't provide a `clientSecret`.
    - `clientSecret`
      The SetupIntent's client secret.

Required if you [collect payment details before creating an Intent](https://docs.stripe.com/payments/accept-a-payment-deferred.md?platform=web&type=setup). It's always required if you don't provide an `elements` instance containing a [client secret](https://docs.stripe.com/api/setup_intents/object.md#setup_intent_object-client_secret).
    - `confirmParams`
      Parameters that will be passed on to the Stripe API. Refer to the [Setup Intents API](https://docs.stripe.com/api/setup_intents/confirm.md) for a full list of parameters.
      - `return_url`
        The URL that Stripe redirects your customer to after they complete authentication.
      - `confirmation_token`
        If collected previously, the ID of the ConfirmationToken to use to confirm this SetupIntent. This is mutually exclusive with the `elements` parameter.
      - `payment_method_data`
        When you call `stripe.confirmSetup`, payment details are collected from the Element and passed to the SetupIntents
[confirm endpoint](https://docs.stripe.com/api/setup_intents/confirm.md) as the [payment_method_data](https://docs.stripe.com/api/setup_intents/confirm.md#confirm_setup_intent-payment_method)
parameter. You can also include additional `payment_method_data` fields, which will be merged with the data collected from the Element.
        - `billing_details`
          The customer's [billing_details](https://docs.stripe.com/api/payment_methods/create.md#create_payment_method-billing_details).
Details collected by Elements will override values passed here.
Billing fields that are omitted in the Payment Element via the `fields` option required.
        - `allow_redisplay`
          Indicates whether the payment method can be displayed to the customer in subsequent checkout flows. The value passed here will override the [allow_redisplay](docs/api/payment_methods/object#payment_method_object-allow_redisplay) determined by the provided `elements` parameter.
      - `expand`
        An array of pass through [SetupIntent](https://docs.stripe.com/api/setup_intents/object.md) expansion parameters ([learn more](https://docs.stripe.com/api/expanding_objects.md)).
    - `redirect`
      By default, `stripe.confirmSetup` will always redirect to your `return_url` after a successful confirmation.
If you set `redirect: "if_required"`, then `stripe.confirmSetup` will only redirect if your user chooses a redirect-based payment method.

**Note**: Setting `if_required` requires that you handle successful confirmations for redirect-based and non-redirect based payment methods separately.
When a non-redirect based payment method is successfully confirmed, `stripe.confirmSetup` will resolve with a `{setupIntent}` object.

### Example

```title
Confirm a setup intent
```

## Confirm a SetupIntent by payment method

Below are a number of methods used to confirm a SetupIntent for a specific payment method type.

## Confirm card setup

`stripe.confirmCardSetup(clientSecret: string, data?: object, options?: object)`

Use `stripe.confirmCardSetup` in the [Setup Intents API flow](https://docs.stripe.com/payments/save-and-reuse.md) when the customer submits your payment form.
When called, it will confirm the [SetupIntent](https://docs.stripe.com/api/setup_intents.md) with `data` you provide and carry out 3DS or other next actions if they are required.

When you confirm a `SetupIntent`, it needs to have an attached [PaymentMethod](https://docs.stripe.com/api/payment_methods.md).
In addition to confirming the `SetupIntent`, 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.confirmCardSetup` 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.confirmCardSetup` may trigger a [3D Secure](https://docs.stripe.com/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.

- `clientSecret`
  The [client secret](https://docs.stripe.com/api/setup_intents/object.md#setup_intent_object-client_secret) of the `SetupIntent`.

- `data`
  Data to be sent with the request.
Refer to the [Setup Intents API](https://docs.stripe.com/api/setup_intents/confirm.md) for a full list of parameters.
    - `payment_method`
      Either the `id` of an existing [PaymentMethod](https://docs.stripe.com/api/payment_methods.md), or an object containing data to create a `PaymentMethod` with.
See the use case sections below for details.
    - `return_url`
      If you are [handling next actions yourself](https://docs.stripe.com/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.

- `options`
  An options object to control the behavior of this method.
    - `handleActions`
      Set this to `false` if you want to [handle next actions yourself](https://docs.stripe.com/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](https://docs.stripe.com/stripe-js/elements/payment-request-button.md#complete-payment-intents)).
Default is `true`.

### with payment data from an Element

### Data argument properties

- `payment_method`
  Pass an object to confirm using data collected by a `card` or `cardNumber` [Element](https://docs.stripe.com/js/element.md).
    - `card`
      Uses the provided `card` or `cardNumber` [Element](https://docs.stripe.com/js/element.md) for confirmation.
    - `billing_details`
      The [billing_details](https://docs.stripe.com/api/payment_methods/create.md#create_payment_method-billing_details) associated with the card.

### Example

```title
Confirm with an Element
```

### with an existing payment method

### Data argument properties

- `payment_method`
  The `id` of an existing [PaymentMethod](https://docs.stripe.com/api/payment_methods.md).

### Example

```title
Confirm with existing payment method
```

### with an existing token

### Data argument properties

- `payment_method`
  Pass an object to confirm using an existing token.
    - `card`
      An object of card data.
      - `token`
        Converts the provided token into a `PaymentMethod` to use for confirmation.
    - `billing_details`
      The [billing_details](https://docs.stripe.com/api/payment_methods/create.md#create_payment_method-billing_details) associated with the card.

### Example

```title
Confirm with existing token
```

### with an attached PaymentMethod

### Example

```title
Confirm with an attached PaymentMethod
```

### Example

```title
Confirm card setup
```

## Confirm an ACH Direct Debit setup

`stripe.confirmUsBankAccountSetup(clientSecret: string, data?: object)`

Use `stripe.confirmUsBankAccountSetup` in the [Save bank details](https://docs.stripe.com/payments/ach-direct-debit/set-up-payment.md) flow for the [ACH Direct Debit](https://docs.stripe.com/payments/ach-direct-debit.md) payment method to record the customer’s authorization for future payments.

When you confirm a [SetupIntent](https://docs.stripe.com/api/setup_intents.md), it needs to have an attached [PaymentMethod](https://docs.stripe.com/api/payment_methods.md).
We suggest using `stripe.collectBankAccountForSetup`, which automatically collects bank account details and attaches a [PaymentMethod](https://docs.stripe.com/api/payment_methods.md). 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.

- `clientSecret`
  The [client secret](https://docs.stripe.com/api/setup_intents/object.md#setup_intent_object-client_secret) of the `SetupIntent`.

- `data`
  Data to be sent with the request.
Refer to the [Setup Intents API](https://docs.stripe.com/api/setup_intents/confirm.md) for a full list of parameters.
    - `payment_method`
      The `id` of an existing PaymentMethod or an object of collected data.
See use cases below for details.

### with an existing PaymentMethod

### Data argument properties

- `payment_method`
  The `id` of an existing [PaymentMethod](https://docs.stripe.com/api/payment_methods.md).

### Example

```title
Confirm with an existing PaymentMethod
```

### with an attached PaymentMethod

### Example

```title
Confirm with an attached PaymentMethod
```

### with self collected bank account information

### Data argument properties

- `payment_method`
  Pass an object to confirm using data collected.
    - `billing_details`
      The customer's [billing_details](https://docs.stripe.com/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](https://docs.stripe.com/payments/ach-direct-debit.md#mandate-and-microdeposit-emails).
      - `name`
        The customer's name. The first and last name must be at minimum 2 characters each.
      - `email`
        The customer's email.
    - `us_bank_account`
      The customer's [bank account information](https://docs.stripe.com/api/payment_methods/create.md#create_payment_method-us_bank_account).
      - `account_number`
        The customer’s bank account number.
      - `routing_number`
        The routing number of the customer’s bank.
      - `account_holder_type`
        Account holder type: individual or company.
      - `account_type`
        Account type: checkings or savings. Defaults to checking if omitted.

### Example

```title
Confirm with bank account information
```

### Example

```title
Confirm an ACH Direct Debit setup
```

## Confirm a Canadian pre-authorized debit setup

`stripe.confirmAcssDebitSetup(clientSecret: string, data?: object, options?: object)`

Use `stripe.confirmAcssDebitSetup` in the [Save bank details](https://docs.stripe.com/payments/acss-debit/set-up-payment.md) flow to set up a [Canadian pre-authorized debit](https://docs.stripe.com/payments/acss-debit.md) payment method for future payments.
When called, it will automatically pop up a modal to collect bank account details and verification, accept the mandate, and confirm the [SetupIntent](https://docs.stripe.com/api/setup_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](https://docs.stripe.com/payments/acss-debit/set-up-payment.md) for more details.

When you confirm a `SetupIntent`, it needs to have an attached [PaymentMethod](https://docs.stripe.com/api/payment_methods.md).
`stripe.confirmAcssDebitSetup` 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.confirmAcssDebitSetup` 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.

- `clientSecret`
  The [client secret](https://docs.stripe.com/api/setup_intents/object.md#setup_intent_object-client_secret) of the `SetupIntent`.

- `data`
  Data to be sent with the request.
Refer to the [Setup Intents API](https://docs.stripe.com/api/setup_intents/confirm.md) for a full list of parameters.
    - `payment_method`
      The `id` of an existing PaymentMethod or an object of collected data.
See use cases below for details.

- `options`
  An options object to control the behavior of this method.
    - `skipMandate`
      Set this to `true` if you want to skip displaying the mandate confirmation.

### with a new PaymentMethod

### Data argument properties

- `payment_method`
  Pass an object to confirm using data collected.
    - `billing_details`
      The customer's [billing_details](https://docs.stripe.com/api/payment_methods/create.md#create_payment_method-billing_details).
`name` and `email` are required.
      - `name`
        The customer's name. The first and last name must be at minimum 2 characters each.
      - `email`
        The customer's email.

### Example

```title
Confirm with a new PaymentMethod
```

### with an existing PaymentMethod

### Data argument properties

- `payment_method`
  The `id` of an existing [PaymentMethod](https://docs.stripe.com/api/payment_methods.md).

### Example

```title
Confirm with an existing PaymentMethod
```

### with an attached PaymentMethod

### Example

```title
Confirm with an attached PaymentMethod
```

### with self collected bank account information

### Data argument properties

- `payment_method`
  Pass an object to confirm using data collected.
    - `billing_details`
      The customer's [billing_details](https://docs.stripe.com/api/payment_methods/create.md#create_payment_method-billing_details).
`name` and `email` are required.
      - `name`
        The customer's name. The first and last name must be at minimum 2 characters each.
      - `email`
        The customer's email.
    - `acss_debit`
      The customer's [bank account information](https://docs.stripe.com/api/payment_methods/create.md#create_payment_method-acss_debit).
      - `account_number`
        The customer’s bank account number.
      - `institution_number`
        The institution number of the customer’s bank.
      - `transit_number`
        The transit number of the customer’s bank.

### Example

```title
Confirm with bank account information
```

### with an existing PaymentMethod but skip mandate display

### Data and options argument paramters

- `data`
  Data to be sent with the request.
    - `payment_method`
      The `id` of an existing [PaymentMethod](https://docs.stripe.com/api/payment_methods.md).

- `options`
  An options object to control the behavior of this method.
    - `skipMandate`
      Set to `true` to skip the on-page modal UI.

### Example

```title
Confirm with an existing PaymentMethod but skip mandate display
```

### Example

```title
Confirm Canadian pre-authorized debit setup
```

## Confirm BECS Debit setup

`stripe.confirmAuBecsDebitSetup(clientSecret: string, data?: object)`

Use `stripe.confirmAuBecsDebitSetup` in the [BECS Direct Debit Payments](https://docs.stripe.com/payments/au-becs-debit.md) flow when the customer submits your payment form.
When called, it will confirm the [SetupIntent](https://docs.stripe.com/api/setup_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](https://docs.stripe.com/payments/au-becs-debit.md) for more details.

When you confirm a `SetupIntent`, it needs to have an attached [PaymentMethod](https://docs.stripe.com/api/payment_methods.md).
In addition to confirming the `SetupIntent`, 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.confirmAuBecsDebitSetup` 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.

- `clientSecret`
  The [client secret](https://docs.stripe.com/api/setup_intents/object.md#setup_intent_object-client_secret) of the `SetupIntent`.

- `data`
  Data to be sent with the request.
Refer to the [Setup Intents API](https://docs.stripe.com/api/setup_intents/confirm.md) for a full list of parameters.
    - `payment_method`
      The `id` of an existing PaymentMethod or an object of collected data.
See use cases below for details.

### with payment data from an Element

### Data argument properties

- `payment_method`
  Pass an `object` to confirm using data collected by an `auBankAccount`
Element.
    - `au_becs_debit`
      An `auBankAccount` [Element](https://docs.stripe.com/js/element.md).
    - `billing_details`
      The customer's [billing_details](https://docs.stripe.com/api/payment_methods/create.md#create_payment_method-billing_details).
`name` and `email` are required.
      - `name`
        The customer's name.
      - `email`
        The customer's email.

### Example

```title
Confirm with an Element
```

### with an existing payment method

### Data argument properties

- `payment_method`
  The `id` of an existing `PaymentMethod`.

### Example

```title
Confirm with existing payment method
```

### with self collected data

### Data argument properties

- `payment_method`
  Pass an object to confirm using data collected without an `Element`.
    - `au_becs_debit`
      An object of self-collected bank account data.
      - `bsb_number`
        A Bank State Branch (BSB) number.
      - `account_number`
        A bank account number.
    - `billing_details`
      The customer's [billing_details](https://docs.stripe.com/api/payment_methods/create.md#create_payment_method-billing_details).
`name` and `email` are required.
      - `name`
        The account holder's name.
      - `email`
        The customer's email.

### Example

```title
Confirm with self collected data
```

### Example

```title
Confirm BECS Debit setup
```

## Confirm Bacs Debit setup

`stripe.confirmBacsDebitSetup(clientSecret: string, data?: object)`

Use `stripe.confirmBacsDebitSetup` in the [Bacs Direct Debit Payments](https://docs.stripe.com/payments/payment-methods/bacs-debit.md) flow when the customer submits your payment form.
When called, it will confirm the [SetupIntent](https://docs.stripe.com/api/setup_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](https://docs.stripe.com/payments/payment-methods/bacs-debit.md) for more details.

When you confirm a `SetupIntent`, it needs to have an attached [PaymentMethod](https://docs.stripe.com/api/payment_methods.md).
In addition to confirming the `SetupIntent`, 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.confirmBacsDebitSetup` 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.

- `clientSecret`
  The [client secret](https://docs.stripe.com/api/setup_intents/object.md#setup_intent_object-client_secret) of the `SetupIntent`.

- `data`
  Data to be sent with the request.
Refer to the [Setup Intents API](https://docs.stripe.com/api/setup_intents/confirm.md) for a full list of parameters.
    - `payment_method`
      The `id` of an existing PaymentMethod or an object of collected data.
See use cases below for details.

### with self collected data

### Data argument properties

- `payment_method`
  Pass an object to confirm using payment method data.
    - `bacs_debit`
      An object of self-collected bank account data.
      - `account_number`
        A bank account number.
      - `sort_code`
        A sort code.
    - `billing_details`
      The customer's [billing_details](https://docs.stripe.com/api/payment_methods/create.md#create_payment_method-billing_details).
`name` and `email` are required.
      - `address`
        The account holder's address.
        - `line1`
          Line 1 of the account holder's address.
        - `city`
          The account holder's city.
        - `country`
          The account holder's country.
        - `postal_code`
          The account holder's postal code.
      - `name`
        The account holder's name.
      - `email`
        The customer's email.

### Example

```title
Confirm with self collected data
```

### with an existing payment method

### Data argument properties

- `payment_method`
  The `id` of an existing `PaymentMethod`.

### Example

```title
Confirm with existing payment method
```

### Example

```title
Confirm Bacs Debit setup
```

## Confirm Bancontact setup

`stripe.confirmBancontactSetup(clientSecret: string, data?: object, options?: object)`

Use `stripe.confirmBancontactSetup` in the [Set up future payments](https://docs.stripe.com/payments/bancontact/set-up-payment.md) flow to use Bancontact bank details to set up a
SEPA Direct Debit payment method for future payments. When called, it will confirm a `SetupIntent` 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`.
Note that there are some additional requirements to this flow that are not covered in this reference.
Refer to our [integration guide](https://docs.stripe.com/payments/bancontact/set-up-payment.md) for more details.

When you confirm a `SetupIntent`, it needs to have an attached [PaymentMethod](https://docs.stripe.com/api/payment_methods.md).
In addition to confirming the `SetupIntent`, 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.confirmBancontactSetup` 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.

- `clientSecret`
  The [client secret](https://docs.stripe.com/api/setup_intents/object.md#setup_intent_object-client_secret) of the `SetupIntent`.

- `data`
  Data to be sent with the request.
Refer to the [Setup Intents API](https://docs.stripe.com/api/setup_intents/confirm.md) for a full list of parameters.
    - `payment_method`
      The `id` of an existing PaymentMethod or an object of collected data.
See use cases below for details.
    - `return_url`
      The url your customer will be directed to after they complete authentication.

- `options`
  An options object to control the behavior of this method.
    - `handleActions`
      Set this to `false` if you want to [manually handle the authorization redirect](https://docs.stripe.com/payments/bancontact/accept-a-payment?platform=web.md#handle-redirect).
Default is `true`.

### with an existing payment method

### Data argument properties

- `payment_method`
  The `id` of an existing `PaymentMethod`.

- `return_url`
  The url your customer will be directed to after they complete authentication.

### Example

```title
Confirm with existing payment method
```

### with self collected data

### Data argument properties

- `payment_method`
  Pass an object to confirm with the customer's name and email.
    - `billing_details`
      The customer's [billing_details](https://docs.stripe.com/api/payment_methods/create.md#create_payment_method-billing_details).
`name` and `email` are required.
      - `name`
        The customer's name.
      - `email`
        The customer's email.

- `return_url`
  The url your customer will be directed to after they complete authentication.

### Example

```title
Confirm with self collected data
```

### Example

```title
Confirm Bancontact setup
```

## Confirm an Cash App Pay setup

`stripe.confirmCashappSetup(clientSecret: string, data?: object, options?: object)`

Use `stripe.confirmCashappSetup` in the [Save payment details](https://docs.stripe.com/payments/cash-app-pay/set-up-payment.md) flow for the [Cash App Pay](https://docs.stripe.com/payments/cash-app-pay.md) payment method to record the customer’s authorization for future payments.

When you confirm a [SetupIntent](https://docs.stripe.com/api/setup_intents.md), it needs to have an attached [PaymentMethod](https://docs.stripe.com/api/payment_methods.md).

In addition to confirming the `SetupIntent`, 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.confirmCashappSetup` 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.

- `clientSecret`
  The [client secret](https://docs.stripe.com/api/setup_intents/object.md#setup_intent_object-client_secret) of the `SetupIntent`.

- `data`
  Data to be sent with the request.
Refer to the [Setup Intents API](https://docs.stripe.com/api/setup_intents/confirm.md) for a full list of parameters.
    - `payment_method`
      The `id` of an existing PaymentMethod or an object of collected data.
See use cases below for details.
    - `return_url`
      The url your customer will be directed to after they complete authentication.

- `options`
  An options object to control the behavior of this method.
    - `handleActions`
      Set this to `false` if you would like to [handle displaying the Cash App Pay QR code or handle the authorization redirect](docs/payments/cash-app-pay/set-up-payment?platform=web&ui=API#web-create-setup-intent) yourself.

### Without an existing payment method

### Data argument properties

- `return_url`
  The url your customer will be directed to after they complete authentication.

### Example

```title
Confirm with bank account information
```

### with an existing PaymentMethod

### Data argument properties

- `payment_method`
  The `id` of an existing [PaymentMethod](https://docs.stripe.com/api/payment_methods.md).

- `return_url`
  The url your customer will be directed to after they complete authentication.

### Example

```title
Confirm with an existing PaymentMethod
```

### with an attached PaymentMethod

### Example

```title
Confirm with an attached PaymentMethod
```

### Example

```title
Confirm a Cash App Pay setup
```

## Confirm iDEAL setup

`stripe.confirmIdealSetup(clientSecret: string, data?: object, options?: object)`

Use `stripe.confirmIdealSetup` in the [Set up future payments](https://docs.stripe.com/payments/ideal/set-up-payment.md) flow to use iDEAL bank details to set up a
SEPA Direct Debit payment method for future payments. When called, it will confirm a `SetupIntent` 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`.
Note that there are some additional requirements to this flow that are not covered in this reference.
Refer to our [integration guide](https://docs.stripe.com/payments/ideal/set-up-payment.md) for more details.

When you confirm a `SetupIntent`, it needs to have an attached [PaymentMethod](https://docs.stripe.com/api/payment_methods.md).
In addition to confirming the `SetupIntent`, 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.confirmIdealSetup` 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.

- `clientSecret`
  The [client secret](https://docs.stripe.com/api/setup_intents/object.md#setup_intent_object-client_secret) of the `SetupIntent`.

- `data`
  Data to be sent with the request.
Refer to the [Setup Intents API](https://docs.stripe.com/api/setup_intents/confirm.md) for a full list of parameters.
    - `payment_method`
      The `id` of an existing PaymentMethod or an object of collected data.
See use cases below for details.
    - `return_url`
      The url your customer will be directed to after they complete authentication.

- `options`
  An options object to control the behavior of this method.
    - `handleActions`
      Set this to `false` if you want to [manually handle the authorization redirect](https://docs.stripe.com/payments/ideal/accept-a-payment?platform=web.md#web-handle-redirect).
Default is `true`.

### with payment data from an Element

### Data argument properties

- `payment_method`
  Pass an object to confirm using data collected by an `idealBank`
Element.
    - `ideal`
      An `idealBank` [Element](https://docs.stripe.com/js/element.md).
    - `billing_details`
      The customer's [billing_details](https://docs.stripe.com/api/payment_methods/create.md#create_payment_method-billing_details).
`name` and `email` are required.
      - `name`
        The customer's name.
      - `email`
        The customer's email.

- `return_url`
  The url your customer will be directed to after they complete authentication.

### Example

```title
Confirm with an Element
```

### with an existing payment method

### Data argument properties

- `payment_method`
  The `id` of an existing `PaymentMethod`.

- `return_url`
  The url your customer will be directed to after they complete authentication.

### Example

```title
Confirm with existing payment method
```

### with self collected data

### Data argument properties

- `payment_method`
  Pass an object to confirm using data collected by an `idealBank`
Element.
    - `ideal`
      An object detailing the customer's iDEAL bank.
      - `bank`
        The customer's [bank](https://docs.stripe.com/payments/ideal/accept-a-payment?platform=web&ui=element.md#bank-reference).
    - `billing_details`
      The customer's [billing_details](https://docs.stripe.com/api/payment_methods/create.md#create_payment_method-billing_details).
`name` and `email` are required.
      - `name`
        The customer's name.
      - `email`
        The customer's email.

- `return_url`
  The url your customer will be directed to after they complete authentication.

### Example

```title
Confirm with self collected data
```

### Example

```title
Confirm iDEAL setup
```

## Confirm a Klarna setup

`stripe.confirmKlarnaSetup(clientSecret: string, data?: object)`

Use `stripe.confirmKlarnaSetup` in the [Klarna Payments with Setup Intents](https://docs.stripe.com/payments/klarna/set-up-payment.md) flow when the customer submits your setup form.
When called, it will confirm the `SetupIntent` with `data` you provide, and it will automatically redirect the customer to authorize the setup.
Once authorization is complete, the customer will be redirected back to your specified `return_url`.

> Note that `stripe.confirmKlarnaSetup` 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.

- `clientSecret`
  The [client secret](https://docs.stripe.com/api/setup_intents/object.md#setup_intent_object-client_secret) of the `SetupIntent`.

- `data`
  Data to be sent with the request.
Refer to the [Setup Intents API](https://docs.stripe.com/api/setup_intents/confirm.md) for a full list of parameters.
    - `payment_method`
      The `id` of an existing [PaymentMethod](https://docs.stripe.com/api/payment_methods.md).
See the use case sections below for details.
    - `return_url`
      The url your customer will be directed to after they complete authentication.

### with an existing payment method

### Data argument properties

- `payment_method`
  The `id` of an existing `PaymentMethod`.

- `return_url`
  The url your customer will be directed to after they complete authentication.

### Example

```title
Confirm with existing payment method
```

### with an attached PaymentMethod

### Example

```title
Confirm with an attached PaymentMethod
```

### with self collected data

### Data argument properties

- `payment_method`
  Pass an object to confirm with the customer's email and billing country.
    - `billing_details`
      The customer's [billing_details](https://docs.stripe.com/api/payment_methods/create.md#create_payment_method-billing_details).
`email` and `address.country` are required.
      - `email`
        The customer's email.
      - `address`
        The customer's billing address.
        - `country`
          The customer's billing country.

- `return_url`
  The url your customer will be directed to after they complete authentication.

### Example

```title
Confirm with self collected data
```

### Example

```title
Confirm a Klarna setup
```

## Confirm a PayPal setup

`stripe.confirmPayPalSetup(clientSecret: string, data?: object)`

Use `stripe.confirmPayPalSetup` in the [PayPal Payments with Setup Intents](https://docs.stripe.com/payments/paypal/set-up-payment.md) flow when the customer submits your setup form.
When called, it will confirm the `SetupIntent`, and it will automatically redirect the customer to authorize the setup.
Once authorization is complete, the customer will be redirected back to your specified `return_url`.

> Note that `stripe.confirmPayPalSetup` 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.

- `clientSecret`
  The [client secret](https://docs.stripe.com/api/setup_intents/object.md#setup_intent_object-client_secret) of the `SetupIntent`.

- `data`
  Data to be sent with the request.
Refer to the [Setup Intents API](https://docs.stripe.com/api/setup_intents/confirm.md) for a full list of parameters.
    - `payment_method`
      The `id` of an existing [PaymentMethod](https://docs.stripe.com/api/payment_methods.md).
See the use case sections below for details.
    - `return_url`
      The url your customer will be directed to after they complete authentication.

### with a new PaymentMethod

### Data argument properties

- `return_url`
  The url your customer will be directed to after they complete authentication.

### Example

```title
Confirm with a new PaymentMethod
```

### with an existing payment method

### Data argument properties

- `payment_method`
  The `id` of an existing `PaymentMethod`.

- `return_url`
  The url your customer will be directed to after they complete authentication.

### Example

```title
Confirm with existing payment method
```

### with an attached PaymentMethod

### Example

```title
Confirm with an attached PaymentMethod
```

### Example

```title
Confirm a PayPal setup
```

## Confirm a PayTo setup

`stripe.confirmPayToSetup(clientSecret: string, data?: object, options?: object)`

Use `stripe.confirmPayToSetup` in the [PayTo Payments with Setup Intents](https://docs.stripe.com/payments/payto/set-up-payment.md) flow when the customer submits your setup form.
When called, it will confirm the `SetupIntent`, and send a request for authorization to the customer.

When you confirm a `SetupIntent`, it needs to have an attached [PaymentMethod](https://docs.stripe.com/api/payment_methods.md).
In addition to confirming the `SetupIntent`, 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.confirmPayToSetup` might take some time to complete while waiting for customers to authorize the PayTo agreement.
> 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.

- `clientSecret`
  The [client secret](https://docs.stripe.com/api/setup_intents/object.md#setup_intent_object-client_secret) of the `SetupIntent`.

- `data`
  Data to be sent with the request.
Refer to the [Setup Intents API](https://docs.stripe.com/api/setup_intents/confirm.md) for a full list of parameters.
    - `payment_method`
      Either the `id` of an existing [PaymentMethod](https://docs.stripe.com/api/payment_methods.md), or an object containing data to create a `PaymentMethod` with.
See the use case sections below for details.

- `options`
  An options object to control the behavior of this method.
    - `handleActions`
      Set this to `false` if you want to manually handle polling for SetupIntent updates.
Default is `true`.

### with a new PaymentMethod

### Data argument properties

- `payment_method`
  Pass payment method billing details.
    - `billing_details`
      The [billing_details](https://docs.stripe.com/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`
      - `name`
    - `payto`
      The [PayTo payment method details](https://docs.stripe.com/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`
      - `account_number`
      - `bsb_number`

### Example

```title
Confirm with a new PaymentMethod
```

### with an existing payment method

### Data argument properties

- `payment_method`
  The `id` of an existing `PaymentMethod`.

### Example

```title
Confirm with existing payment method
```

### with an attached PaymentMethod

### Example

```title
Confirm with an attached PaymentMethod
```

### Example

```title
Confirm a PayTo setup
```

## Confirm SEPA Debit setup

`stripe.confirmSepaDebitSetup(clientSecret: string, data?: object)`

Use `stripe.confirmSepaDebitSetup` in the [SEPA Direct Debit with Setup Intents](https://docs.stripe.com/payments/sepa-debit-setup-intents.md) flow when the customer submits your payment form.
When called, it will confirm the `SetupIntent` 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](https://docs.stripe.com/payments/sepa-debit-setup-intents.md) for more details.

When you confirm a `SetupIntent`, it needs to have an attached [PaymentMethod](https://docs.stripe.com/api/payment_methods.md).
In addition to confirming the `SetupIntent`, 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.confirmSepaDebitSetup` 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.

- `clientSecret`
  The [client secret](https://docs.stripe.com/api/setup_intents/object.md#setup_intent_object-client_secret) of the `SetupIntent`.

- `data`
  Data to be sent with the request.
Refer to the [Setup Intents API](https://docs.stripe.com/api/setup_intents/confirm.md) for a full list of parameters.
    - `payment_method`
      The `id` of an existing PaymentMethod or an object of collected data.
See use cases below for details.

### with payment data from an Element

### Data argument properties

- `payment_method`
  Pass an `object` to confirm using data collected by an `iban`
Element.
    - `sepa_debit`
      An `iban` [Element](https://docs.stripe.com/js/element.md).
    - `billing_details`
      The customer's [billing_details](https://docs.stripe.com/api/payment_methods/create.md#create_payment_method-billing_details).
`name` and `email` are required.
      - `name`
        The customer's name.
      - `email`
        The customer's email.

### Example

```title
Confirm with an Element
```

### with an existing payment method

### Data argument properties

- `payment_method`
  The `id` of an existing `PaymentMethod`.

### Example

```title
Confirm with existing payment method
```

### with self collected data

### Data argument properties

- `payment_method`
  Pass an `object` to confirm using data collected by an `iban`
Element.
    - `sepa_debit`
      An object of self-collected IBAN data.
      - `iban`
        An IBAN account number.
    - `billing_details`
      The customer's [billing_details](https://docs.stripe.com/api/payment_methods/create.md#create_payment_method-billing_details).
`name` and `email` are required.
      - `name`
        The customer's name.
      - `email`
        The customer's email.

### Example

```title
Confirm with self collected data
```

### Example

```title
Confirm SEPA Debit setup
```

## Confirm Sofort setup

`stripe.confirmSofortSetup(clientSecret: string, data?: object, options?: object)`

Use `stripe.confirmSofortSetup` in the [Set up future payments](https://docs.stripe.com/payments/sofort/set-up-payment.md) flow to use SOFORT bank details to set up a
SEPA Direct Debit payment method for future payments. When called, it will confirm a `SetupIntent` 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`.
Note that there are some additional requirements to this flow that are not covered in this reference.
Refer to our [integration guide](https://docs.stripe.com/payments/sofort/set-up-payment.md) for more details.

When you confirm a `SetupIntent`, it needs to have an attached [PaymentMethod](https://docs.stripe.com/api/payment_methods.md).
In addition to confirming the `SetupIntent`, 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.confirmSofortSetup` 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.

- `clientSecret`
  The [client secret](https://docs.stripe.com/api/setup_intents/object.md#setup_intent_object-client_secret) of the `SetupIntent`.

- `data`
  Data to be sent with the request.
Refer to the [Setup Intents API](https://docs.stripe.com/api/setup_intents/confirm.md) for a full list of parameters.
    - `payment_method`
      The `id` of an existing PaymentMethod or an object of collected data.
See use cases below for details.
    - `return_url`
      The url your customer will be directed to after they complete authentication.

- `options`
  An options object to control the behavior of this method.
    - `handleActions`
      Set this to `false` if you want to [manually handle the authorization redirect](https://docs.stripe.com/payments/sofort/accept-a-payment?platform=web.md#handle-redirect).
Default is `true`.

### with an existing payment method

### Data argument properties

- `payment_method`
  The `id` of an existing `PaymentMethod`.

- `return_url`
  The url your customer will be directed to after they complete authentication.

### Example

```title
Confirm with existing payment method
```

### with self collected data

### Data argument properties

- `payment_method`
  Pass an object to confirm with the customer's name and email.
    - `country`
      The country code where customer's bank is located.
    - `billing_details`
      The customer's [billing_details](https://docs.stripe.com/api/payment_methods/create.md#create_payment_method-billing_details).
`name` and `email` are required.
      - `name`
        The customer's name.
      - `email`
        The customer's email.

- `return_url`
  The url your customer will be directed to after they complete authentication.

### Example

```title
Confirm with self collected data
```

### Example

```title
Confirm SOFORT setup
```

## Retrieve a SetupIntent

`stripe.retrieveSetupIntent(clientSecret: string)`

Retrieve a [SetupIntent](https://docs.stripe.com/api/setup_intents.md) using its client secret.

- `clientSecret`
  The [client secret](https://docs.stripe.com/api/setup_intents/object.md#setup_intent_object-client_secret) of the `SetupIntent` to retrieve.

### Example

```title
Retrieve a SetupIntent
```

## Verify with micro-deposits for setup

`stripe.verifyMicrodepositsForSetup(clientSecret: string, data?: object)`

Use `stripe.verifyMicrodepositsForSetup` in the [Save details for future payments with pre-authorized debit in Canada](https://docs.stripe.com/payments/acss-debit/set-up-payment.md) or [Save details for future payments with ACH Direct Debit](https://docs.stripe.com/payments/ach-direct-debit/set-up-payment.md) flow to verify a customer's bank account with micro-deposits.

It should be only called when [SetupIntent](https://docs.stripe.com/api/setup_intents.md) is in the `requires_action` state, and contains a `next_action` field that has a `type` equal to `verify_with_microdeposits`.
Refer to our [integration guide](https://docs.stripe.com/payments/acss-debit/set-up-payment.md) for more details.

> Verification can fail for several reasons. The failure may happen synchronously as a direct error response, or asynchronously through a `payment_intent.payment_failed` webhook event.
> Refer to our [integration guide](https://docs.stripe.com/payments/acss-debit/accept-a-payment.md) for more details.

- `clientSecret`
  The [client secret](https://docs.stripe.com/api/setup_intents/object.md#setup_intent_object-client_secret) of the `SetupIntent`.

- `data`
  Data to be sent with the request.
    - `amounts`
      An array of two positive integers, in *cents*, equal to the values of the micro-deposits sent to the bank account.
    - `descriptor_code`
      A six-character code starting with SM present in the microdeposit sent to the bank account.

### Example

```title
Verify with micro-deposits for setup
```

## Handle a next action

`stripe.handleNextAction(options: object)`

Use `stripe.handleNextAction` in the [finalizing payments on the server](https://docs.stripe.com/payments/finalize-payments-on-the-server.md#next-actions)
flow to finish confirmation of a [SetupIntent](https://docs.stripe.com/api/setup_intents.md) with the `requires_action` status.
It will throw an error if the SetupIntent has a different status.

Depending on the payment method and required action, the customer may be temporarily redirected from your site
and brought back to the `return_url` [parameter](https://docs.stripe.com/api/setup_intents/confirm.md#confirm_setup_intent-return_url) provided when the SetupIntent is confirmed.

> Note that `stripe.handleNextAction` 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.handleNextAction` may trigger a [3D Secure](https://docs.stripe.com/payments/3d-secure.md) authentication challenge.
> The authentication challenge requires a context switch that can be hard to follow on a screen-reader.
> Ensure that your form is accessible by ensuring that success or error messages are clearly read out.

- `options`
    - `clientSecret`
      The [client secret](https://docs.stripe.com/api/setup_intents/object.md#setup_intent_object-client_secret) of the `SetupIntent`.

### Example

```title
Handle a next action
```

## Collect bank account details for setup

`stripe.collectBankAccountForSetup(options: object)`

Use `stripe.collectBankAccountForSetup` in the [Save bank details](https://docs.stripe.com/payments/ach-direct-debit/set-up-payment.md) flow for the [ACH Direct Debit](https://docs.stripe.com/payments/ach-direct-debit.md) payment method to collect the customer’s bank account in your payment form.
When called, it will automatically load an on-page modal UI to collect bank account details and verification, and attach the [PaymentMethod](https://docs.stripe.com/api/payment_methods.md) to the [SetupIntent](https://docs.stripe.com/api/setup_intents.md).

- `options`
  Data to be sent with the request.
    - `clientSecret`
      The [client secret](https://docs.stripe.com/api/setup_intents/object.md#setup_intent_object-client_secret) of the `SetupIntent`.
    - `params`
      - `payment_method_type`
        The payment method type for the bank account details (e.g. `us_bank_account`)
      - `payment_method_data`
        Payment method specific data to be sent with the request
        - `billing_details`
          The customer's [billing_details](https://docs.stripe.com/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](https://docs.stripe.com/payments/ach-direct-debit.md#mandate-and-microdeposit-emails).
          - `name`
            The customer's name. The first and last name must be at minimum 2 characters each.
          - `email`
            The customer's email.
          - `address`
            The customer's billing address.
            - `city`
              City, district, suburb, town, or village.
            - `country`
              Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)).
            - `line1`
              Address line 1 (e.g., street, PO Box, or company name).
            - `line2`
              Address line 2 (e.g., apartment, suite, unit, or building).
            - `postal_code`
              ZIP or postal code.
            - `state`
              State, county, province, or region.

### Example

```title
Collect bank account details for setup
```
