## 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, } ); ```