## Confirm a UPI payment Use `stripe.confirmUpiPayment` when customer submits your payment form. When called, it will confirm the [PaymentIntent](/api/payment_intents.md), and return a `Promise` which resolves with the PaymentIntent having its final payment status. Since the authentication for UPI payments happen on customer's mobile device, and the timeout for such authentication is 5 minutes, the `Promise` returned by `stripe.confirmUpiPayment` can take upto 5 minutes to resolve. We recommend showing an appropriate message to the customer indicating their payment is being processed. > Note that `stripe.confirmUpiPayment` may take several minutes 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. By default, `stripe.confirmUpiPayment` will return a `Promise` which resolves with the [PaymentIntent](/api/payment_intents). If there is an error, or when handling next actions manually by using the `handleActions: false` option, it will return a `Promise` which resolves with a `result` object. This object has either: * `result.paymentIntent`: the successful [PaymentIntent](/api/payment_intents). * `result.error`: an error. Refer to the [API reference](/api/errors) for all possible errors. **Syntax:** `stripe.confirmUpiPayment(...)` - `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` (string | object) Either the `id` of an existing [PaymentMethod](/api/payment_methods.md), or an object containing data to create a `PaymentMethod` with. See the use case sections below for details. - `options` (object) An options object to control the behavior of this method. - `handleActions` (boolean) Set this to `false` if you want to manually poll for the [PaymentIntent status](/api/payment_intents/retrieve.md). Default is `true`. ### Use case: with self collected data If you already know the customer's VPA or have collected it, then you can pass it directly. This will automatically create a new `PaymentMethod`. ### Data argument properties - `vpa` (string) **required** VPA of the customer using which the payment needs to be authenticated. ### Confirm with self collected data ```js stripe .confirmUpiPayment('{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: { upi: { vpa: 'stripe@upi' } } }) .then(function(result) { if (result.error) { // Inform the customer that there was an error. } else{ // Inform the customer the status of their payment. } }); ``` ```es_next const {error} = await stripe.confirmUpiyPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: { upi: { vpa: 'stripe@upi' } } }, ); ``` ### Use case: with an attached PaymentMethod If you have already attached a `PaymentMethod` to this `PaymentIntent`, you can then confirm the `PaymentIntent` using `stripe.confirmUpiPayment` without passing in any additional data. ### Confirm with an attached PaymentMethod ```js stripe .confirmUpiPayment('{PAYMENT_INTENT_CLIENT_SECRET}') .then(function(result) { if (result.error) { // Inform the customer that there was an error. } else{ // Inform the customer the status of their payment. } }); ``` ```es_next const {error} = await stripe.confirmUpiPayment('{PAYMENT_INTENT_CLIENT_SECRET}'); ``` ### Confirm a UPI payment ```js stripe .confirmUpiPayment('{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: { upi: { vpa: 'stripe@upi' } } }) .then(function(result) { if (result.error) { // Inform the customer that there was an error. } else{ // Inform the customer the status of their payment. } }); ``` ```es_next const {error} = await stripe.confirmUpiyPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: { upi: { vpa: 'stripe@upi' } } }, ); ```