## Confirm a Canadian pre-authorized debit payment

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

Use `stripe.confirmAcssDebitPayment` in the [Accept a payment](https://docs.stripe.com/payments/acss-debit/accept-a-payment.md) flow for the [Canadian pre-authorized debit](https://docs.stripe.com/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](https://docs.stripe.com/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](https://docs.stripe.com/payments/acss-debit/accept-a-payment.md) for more details.

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

* `clientSecret` The [client secret](https://docs.stripe.com/api/payment_intents/object.md#payment_intent_object-client_secret) of the `PaymentIntent`.
* `data` Data to be sent with the request. Refer to the [Payment Intents API](https://docs.stripe.com/api/payment_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`

### Example

```javascript title=Confirm with a new PaymentMethod
const stripe = await stripe_js.loadStripe('pk_test_...');
const result = await stripe.confirmAcssDebitPayment(clientSecret, {
  payment_method: {
    billing_details: {
      name: 'Jenny Rosen',
      email: 'jenny.rosen@example.com',
    },
  },
});
// Handle result.error
```

### with an existing PaymentMethod

#### Data argument properties

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

### Example

```javascript title=Confirm with an existing PaymentMethod
const stripe = await stripe_js.loadStripe('pk_test_...');
const result = await stripe.confirmAcssDebitPayment(clientSecret, {
  payment_method: 'pm_12345',
});
// Handle result.error
```