## Confirm a Canadian pre-authorized debit setup Use `stripe.confirmAcssDebitSetup` in the [Save bank details](/payments/acss-debit/set-up-payment.md) flow to set up a [Canadian pre-authorized debit](/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](/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](/payments/acss-debit/set-up-payment.md) for more details. When you confirm a `SetupIntent`, it needs to have an attached [PaymentMethod](/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. `stripe.confirmAcssDebitSetup` will return a `Promise` which resolves with a result object. This object has either: * `result.setupIntent`: the successful [SetupIntent](/api/setup_intents). * `result.error`: an error. Refer to the [API reference](/api#errors) and our [integration guide](/payments/acss-debit/set-up-payment) for all possible errors. **Syntax:** `stripe.confirmAcssDebitSetup(...)` - `clientSecret` (string) **required** The [client secret](/api/setup_intents/object.md#setup_intent_object-client_secret) of the `SetupIntent`. - `data` (object) Data to be sent with the request. Refer to the [Setup Intents API](/api/setup_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 `SetupIntent`. 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.confirmAcssDebitSetup( '{SETUP_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 SetupIntent's status. console.log("SetupIntent ID: " + result.setupIntent.id); console.log("SetupIntent status: " + result.setupIntent.status); } }); ``` ```es_next const {setupIntent, error} = await stripe.confirmAcssDebitSetup( '{SETUP_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 SetupIntent's status. console.log("SetupIntent ID: " + setupIntent.id); console.log("SetupIntent status: " + setupIntent.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.confirmAcssDebitSetup`. 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.confirmAcssDebitSetup( '{SETUP_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 SetupIntent's status. console.log("SetupIntent ID: " + result.setupIntent.id); console.log("SetupIntent status: " + result.setupIntent.status); } }); ``` ```es_next const {setupIntent, error} = await stripe.confirmAcssDebitSetup( '{SETUP_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 SetupIntent's status. console.log("SetupIntent ID: " + setupIntent.id); console.log("SetupIntent status: " + setupIntent.status); } ``` ### Use case: with an attached PaymentMethod If you have already attached a `PaymentMethod` to this `SetupIntent`, then you can confirm the `SetupIntent` 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.confirmAcssDebitSetup( '{SETUP_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 SetupIntent's status. console.log("SetupIntent ID: " + result.setupIntent.id); console.log("SetupIntent status: " + result.setupIntent.status); } }); ``` ```es_next const {setupIntent, error} = await stripe.confirmAcssDebitSetup( '{SETUP_INTENT_CLIENT_SECRET}', {} ); if (error) { // Inform the customer that there was an error. console.log(error.message); } else { // Handle next step based on SetupIntent's status. console.log("SetupIntent ID: " + setupIntent.id); console.log("SetupIntent status: " + setupIntent.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 `SetupIntent`. 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.confirmAcssDebitSetup( '{SETUP_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 SetupIntent's status. console.log("SetupIntent ID: " + result.setupIntent.id); console.log("SetupIntent status: " + result.setupIntent.status); } }); ``` ```es_next const {setupIntent, error} = await stripe.confirmAcssDebitSetup( '{SETUP_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 SetupIntent's status. console.log("SetupIntent ID: " + setupIntent.id); console.log("SetupIntent status: " + setupIntent.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.confirmAcssDebitSetup` 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.confirmAcssDebitSetup( '{SETUP_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 SetupIntent's status. console.log("SetupIntent ID: " + result.setupIntent.id); console.log("SetupIntent status: " + result.setupIntent.status); } }); ``` ```es_next const {setupIntent, error} = await stripe.confirmAcssDebitSetup( '{SETUP_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 SetupIntent's status. console.log("SetupIntent ID: " + setupIntent.id); console.log("SetupIntent status: " + setupIntent.status); } ``` ### Confirm Canadian pre-authorized debit setup ```js stripe.confirmAcssDebitSetup( '{SETUP_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 SetupIntent's status. console.log("SetupIntent ID: " + result.setupIntent.id); console.log("SetupIntent status: " + result.setupIntent.status); } }); ``` ```es_next const {setupIntent, error} = await stripe.confirmAcssDebitSetup( '{SETUP_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 SetupIntent's status. console.log("SetupIntent ID: " + setupIntent.id); console.log("SetupIntent status: " + setupIntent.status); } ```