> ## Documentation Index
> Fetch the complete documentation index at: https://docs.appcharge.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Frontend Events

The `AppchargeCheckout` component supports the following front-end event properties to enable realtime analytics:

| Event Name                     | Type     | Required | Has Parameters | Description                                                                           |
| ------------------------------ | -------- | -------- | -------------- | ------------------------------------------------------------------------------------- |
| `onClose`                      | Function | No       | Yes            | Triggered when the checkout popup is closed.                                          |
| `onOrderCreated`               | Function | No       | Yes            | Triggered when an order is created.                                                   |
| `onOrderCompletedFailed`       | Function | No       | Yes            | Triggered when an order failed due to an internal error or publisher reward error.    |
| `onOrderCompletedSuccessfully` | Function | No       | Yes            | Triggered when an order was updated with the publisher and confirmation was received. |
| `onPaymentIntent`              | Function | No       | Yes            | Triggered when the player clicks **Pay**.                                             |
| `onPaymentIntentFailed`        | Function | No       | Yes            | Triggered when the player clicks **Pay** and the payment fails.                       |
| `onPaymentIntentSuccess`       | Function | No       | Yes            | Triggered when the player clicks **Pay** and the payment is charged successfully.     |

## Event parameters

Below are the parameters that you can pass to the event functions. Not all parameters are available for every event, and ones that are unavailable will be `undefined`.

| Name                       | Description                                                                              | Event Name                                                                                                                 |
| -------------------------- | ---------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- |
| `orderId`                  | Order ID.                                                                                | All                                                                                                                        |
| `date`                     | Epoch timestamp.                                                                         | All                                                                                                                        |
| `bundleId`                 | Bundle ID.                                                                               | All                                                                                                                        |
| `bundleName`               | Bundle name.                                                                             | All                                                                                                                        |
| `bundleSKU`                | Stock Keeping Unit (SKU) for the bundle.                                                 | All                                                                                                                        |
| `products[]`               | An array of products included in the order.                                              | All                                                                                                                        |
| `sessionId`                | Identifier for the session associated with the order.                                    | All                                                                                                                        |
| `totalSum`                 | The total sum of the order.                                                              | All                                                                                                                        |
| `totalSumCurrency`         | Currency of the total sum.                                                               | All                                                                                                                        |
| `userCountry`              | The country associated with the player.                                                  | All                                                                                                                        |
| `userId`                   | Player ID.                                                                               | All                                                                                                                        |
| `promoCode`                | Promo code applied to the order. Returned only when a coupon was used.                   | All                                                                                                                        |
| `reason`                   | Reason for the failure or additional notes.                                              | `onPaymentIntentFailed` `onOrderCompletedFailed`                                                                           |
| `paymentMethodName`        | Name of the payment method used for the order.                                           | `onPaymentIntentSuccess` `onOrderCompletedSuccessfully` `onPaymentIntent` `onPaymentIntentFailed` `onOrderCompletedFailed` |
| `isSavedPaymentMethodUsed` | Whether the player used or attempted to use a saved card (card on file) during checkout. | `onPaymentIntentSuccess` `onOrderCompletedSuccessfully` `onPaymentIntent` `onPaymentIntentFailed` `onOrderCompletedFailed` |
| `isNewPaymentMethodSaved`  | Whether the player saved or attempted to save a new card during checkout.                | `onPaymentIntentSuccess` `onOrderCompletedSuccessfully` `onPaymentIntent` `onPaymentIntentFailed` `onOrderCompletedFailed` |
