## Handle a next action Use `stripe.handleNextAction` in the [finalizing payments on the server](/payments/finalize-payments-on-the-server.md#next-actions) flow to finish confirmation of a [SetupIntent](/api/setup_intents.md) with the `requires_action` status. It will throw an error if the SetupIntent has a different status. Depending on the payment method and required action, the customer may be temporarily redirected from your site and brought back to the `return_url` [parameter](/api/setup_intents/confirm.md#confirm_setup_intent-return_url) provided when the SetupIntent is confirmed. > Note that `stripe.handleNextAction` 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. > > Additionally, `stripe.handleNextAction` may trigger a [3D Secure](/payments/3d-secure.md) authentication challenge. > The authentication challenge requires a context switch that can be hard to follow on a screen-reader. > Ensure that your form is accessible by ensuring that success or error messages are clearly read out. This method returns a `Promise` which resolves with a `result` object. This object has either: * `result.setupIntent`: a [SetupIntent](/api/setup_intents) with the `processing` or `succeeded` status. * `result.error`: an error. Refer to the [API reference](/api/errors) for all possible errors. **Syntax:** `stripe.handleNextAction(...)` - `options` (object) **required** - `clientSecret` (string) The [client secret](/api/setup_intents/object.md#setup_intent_object-client_secret) of the `SetupIntent`. ### Handle a next action ```js stripe.handleNextAction({ clientSecret: '{SETUP_INTENT_CLIENT_SECRET}' }).then(function(result) { // Handle result.error or result.setupIntent }); ``` ```es_next const { setupIntent, error } = await stripe.handleNextAction({ clientSecret: '{SETUP_INTENT_CLIENT_SECRET}', }); // Handle the setupIntent or error ```