## Confirm a Payment Intent

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

*`confirmPaymentIntent` has been deprecated.
Going forward, if you wish to confirm on the client without handling next actions, simply pass `{handleActions: false}` as a third argument to [confirmCardPayment](#stripe_confirm_card_payment).
While we have no plans to ever remove support for `confirmPaymentIntent`, we think that explicitly opting out of next action handling is easier to understand and will better convey what the method is doing.*

Use `stripe.confirmPaymentIntent(clientSecret, data)` to confirm the `PaymentIntent` when you are not gathering payment information from an `Element`.
Call this variation when you have already attached a payment method to this `PaymentIntent`, or if you want to attach an existing card, token, or `PaymentMethod` to it.

Only use this method if you want to handle next actions yourself.
Otherwise, use `stripe.handleCardPayment`.

> Note that `stripe.confirmPaymentIntent` 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/payment_intents/object.md#payment_intent_object-client_secret) of the `PaymentIntent` to confirm.

- `data`
  Data to be sent with the request. It can contain the following parameters
    - `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.
    - `payment_method`
      Use `payment_method` to specify an existing [PaymentMethod](https://docs.stripe.com/api/payment_methods.md) to use for this payment.

Only one of `payment_method_data` and `payment_method` is required.
    - `payment_method_data`
      Use this parameter to supply additional data relevant to the payment method, such as billing details.
      - `billing_details`
        The [billing details](https://docs.stripe.com/api/payment_methods/create.md#create_payment_method-billing_details) associated with the card.
      - `card[token]`
        Converts the provided token into a `PaymentMethod` to use for the payment.
    - `shipping`
      The [shipping details](https://docs.stripe.com/api/payment_intents/confirm.md#confirm_payment_intent-shipping) for the payment, if collected.
    - `receipt_email`
      Email address that the receipt for the resulting payment will be sent to.
    - `setup_future_usage`
      Indicates that you intend to make future payments with this [PaymentIntent](https://docs.stripe.com/api/payment_intents.md)'s payment method.

If present, the `PaymentMethod` used with this PaymentIntent can be [attached to a Customer](https://docs.stripe.com/api/payment_methods/attach.md), even after the transaction completes.

Use `on_session` if you intend to only reuse the `PaymentMethod` 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 after a payment](https://docs.stripe.com/payments/cards/saving-cards-after-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, using `off_session` will ensure that they are authenticated while processing this PaymentIntent.
You will then be able to collect [off-session payments](https://docs.stripe.com/payments/cards/charging-saved-cards.md#off-session-payments-with-saved-cards) for this customer.

### Example

```title
Confirm a PaymentIntent
```
