## Handle an FPX payment *`handleFpxPayment` has been renamed to [confirmFpxPayment](#stripe_confirm_fpx_payment). In addition to the rename, we have slightly modified the arguments. These changes do not affect the behavior of the method. While we will continue to support `handleFpxPayment` for the duration of the beta, we think the new name and arguments are easier to understand and better convey what the method is doing.* Use `stripe.handleFpxPayment` in the [FPX payment method creation](/stripe-js/elements/fpx-bank.md) flow when the customer selects a bank from the dropdown. It will gather the [bank code](/payments/fpx/accept-a-payment.md#bank-reference) from the element, along with any other `PaymentIntent` `data` you provide. It will then create an FPX payment method and confirm the `PaymentIntent`. > Note that `stripe.handleFpxPayment` 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. This method returns a `Promise` which resolves with a `result` object. This object has either: * `result.paymentIntent`: a [PaymentIntent](/api/payment_intents) with the `requires_confirmation` status to confirm server-side. * `result.error`: an error. Refer to the [API reference](/api#errors) for all possible errors and the [FPX guide](/payments/fpx/accept-a-payment#error-codes) for FPX specific errors. **Syntax:** `stripe.handleFpxPayment(...)` - `clientSecret` (string) **required** The [client secret](/api/payment_intents/object.md#payment_intent_object-client_secret) of the `PaymentIntent`. - `element` (Element) **required** An `fpxBank` [Element](/payments/elements.md) that will be used to create a payment method. - `data` (object) A data object to be sent with the request. - `return_url` (string) The url your customer will be directed to after they complete authentication. Be sure to review the [payment confirmation page requirements](/payments/fpx/accept-a-payment.md#payment-confirmation-page). ### Handle a FPX payment ```js stripe.handleFpxPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', element, { return_url: 'https://example.com/return_url', } ).then(function(result) { // Handle result.error or result.paymentIntent }); ``` ```es_next const {paymentIntent, error} = await stripe.handleFpxPayment( '{PAYMENT_INTENT_CLIENT_SECRET}', element, { return_url: 'https://example.com/return_url', } ); ```