## Confirm event

`expressCheckoutElement.on(event: string, handler: function)`

The `confirm` event is triggered from an Express Checkout Element when the customer
finalizes their payment. Use this event to trigger payment confirmation.

- `event`
  The name of the event.
In this case, `confirm`.

- `handler`
  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`
      The type of element the event fires from, which is `expressCheckout` in this case.
    - `expressPaymentType`
      The payment method the customer checks out with.
    - `paymentFailed`
      A function `paymentFailed(payload) => void` that's called if you're unable
to process the customer's payment.
      - `reason`
        Default is `'fail'`. The payment interface might surface the reason
to provide a hint to the customer on why their payment failed.
      - `message`
        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.

**Wallet compatibility:** Apple Pay displays custom error messages for `'invalid_shipping_address'`, `'invalid_billing_address'`, and `'invalid_payment_data'`, but not for `'fail'` or `'address_unserviceable'`. Other wallets may not support custom messages or may truncate them.
    - `billingDetails`
      Object containing information about the customer's billing details.
      - `name`
        The name of the customer.
      - `email`
        The email address of the customer.
      - `phone`
        The phone number of the customer.
      - `address`
        The billing address of the customer.
        - `line1`
        - `line2`
        - `city`
        - `state`
        - `postal_code`
        - `country`
    - `shippingAddress`
      Object containing information about the customer's shipping address.
      - `name`
        The name of the recipient.
      - `address`
        The shipping address of the customer.
        - `line1`
        - `line2`
        - `city`
        - `state`
        - `postal_code`
        - `country`
    - `shippingRate`
      Object containing information about the selected shipping rate.
      - `id`
        Unique identifier for the object.
      - `amount`
        The amount to charge for shipping.
      - `displayName`
        The name of the shipping rate, displayed to the customer in the payment interface.
      - `deliveryEstimate`
        The estimated range for how long shipping takes, displayed to the customer in the payment interface.
We recommended using the object format, but you can use a string instead.
        - `maximum`
          The upper bound of the estimated range. If empty, it represents no upper bound (for example, infinite).
          - `unit`
            A unit of time.
          - `value`
            Must be greater than 0.
        - `minimum`
          The lower bound of the estimated range. If empty, it represents no lower bound.
          - `unit`
            A unit of time.
          - `value`
            Must be greater than 0.

### Example

```title
Handle 'confirm' event
```
