## Confirm event The `confirm` event is triggered from the Express Checkout Element when the customer finalizes their payment. Use this event to trigger payment confirmation. This event is only available on the Express Checkout Element. **Syntax:** `expressCheckoutElement.on(...)` - `event` (string) **required** The name of the event. In this case, `confirm`. - `handler` (function) **required** A callback function `handler(event) => void` you provide that's called after the event is fired. When called, it passes an event object with the following properties: - `elementType` ('expressCheckout') **required** The type of element the event fires from, which is `expressCheckout` in this case. - `expressPaymentType` ('apple_pay' | 'google_pay' | 'amazon_pay' | 'paypal' | 'link' | 'klarna') **required** The payment method the customer checks out with. - `paymentFailed` (function) **required** A function `paymentFailed(payload) => void` that's called if you're unable to process the customer's payment. - `reason` ('fail' | 'invalid_shipping_address' | 'invalid_billing_address' | 'invalid_payment_data' | 'address_unserviceable') Default is `'fail'`. The payment interface might surface the reason to provide a hint to the customer on why their payment failed. - `message` (string) A short, concise, localized error message to display on the payment sheet. If none is provided, the payment sheet will display a generic error message for the given reason. - `billingDetails` (object) Object containing information about the customer's billing details. - `name` (string) The name of the customer. - `email` (string) The email address of the customer. - `phone` (string) The phone number of the customer. - `address` (object) The billing address of the customer. - `shippingAddress` (object) Object containing information about the customer's shipping address. - `name` (string) The name of the recipient. - `address` (object) The shipping address of the customer. - `shippingRate` (object) Object containing information about the selected shipping rate. ### Handle 'confirm' event ```js const expressCheckoutElement = checkout.createExpressCheckoutElement(); expressCheckoutElement.on('confirm', function(event) { // call actions.confirm() to confirm the payment actions.confirm().then(function(result) { if (result.type === 'error') { // Inform the customer that there's an error. } }); }); ``` ```es_next const expressCheckoutElement = checkout.createExpressCheckoutElement(); expressCheckoutElement.on('confirm', async (event) => { // call actions.confirm() to confirm the payment const result = await actions.confirm(); if (result.type === 'error') { // Inform the customer that there's an error. } }); ```