Skip to main content
Available in🇮🇳 India
This page is a technical reference for all Magic Checkout analytics events. For setup instructions, see the Magic Checkout Analytics Integration guide.

Common Payload Fields

Every mx-analytics event payload contains the following base fields. Event-specific additional fields are documented under each event in the Event Reference.
event : string The event name (for example, "initiate", "payment_initiated").paymentMode : string Payment mode. Currently it is always "online".lineItems : LineItem[] Cart items at the time the event fired. See LineItem Schema.totalAmount : number Original cart total in paise (before shipping or discounts).latestTotal : number Current order total in paise, reflecting any applied discounts and shipping.shippingAmount optional : number Shipping cost in paise. Undefined if not yet calculated.couponDiscountValue : number Discount applied by an active coupon in paise. 0 if no coupon is active.isScriptCouponApplied : boolean Whether an automatic/script-based discount is applied.currency : string Transaction currency code (for example, "INR").phone : string Customer’s phone number. Empty string if not yet available.email : string Customer’s email address. Empty string if not yet available.first_name : string Customer’s first name. Empty string if not yet available.last_name : string Customer’s last name. Empty string if not yet available.state : string Customer’s state. Empty string if address not yet selected.city : string Customer’s city. Empty string if address not yet selected.
Important Payload Information
  • Field Naming Conventions: Payloads use mixed casing based on their source. Amount and mode fields (for example, latestTotal, paymentMode) use camelCase as they originate from JavaScript. Customer identity and address fields (for example, first_name, state_code) use snake_case as they originate from backend API responses.
  • Currency Format: All amounts are represented in paise (integers). To get the value in Rupees, divide by 100 (for example, 49900 = ₹499.00).
  • Progressive Data Population: Customer fields are populated in stages. phone and email appear after contact entry. However, first_name, last_name, state and city remain empty strings until the address_info_submitted event fires.
    • After address_info_submitted fires, additional fields —state_code, country_name, zipcode, line1 and line2— become available in all subsequent payloads.
    • The country_name field actually contains a 2-letter country code (for example, “in”) rather than the full name of the country.

LineItem Schema

Each object in the lineItems array reflects what was passed in line_items when creating the order. All fields are optional as not every integration populates every field.
name optional : string Product name.description optional : string Product description. May be an empty string.image_url optional : string | null Product image URL.price optional : number Original price in paise.offer_price optional : number Effective/offer price in paise.quantity optional : number Quantity in cart.tax_amount optional : number Tax amount in paise.variant_id optional : string Product variant identifier.sku optional : string Product SKU.title optional : string Alternate product name (used by some integrations).id optional : string | number Generic product/item identifier.product_id optional : string | number Product identifier.discount optional : number Discount amount in paise.product_url optional : string Relative URL to the product page.brand optional : string Product brand.vendor optional : string Product vendor.

Address Schema

The address object is present in address_selected and address_added events.
id : string Unique address identifier.entity_id : string Internal Razorpay identifier.entity_type : string Internal Razorpay identifier.type : string Address type, for example, "shipping_address".primary : boolean Indicates whether this is the customer’s primary address.name : string Full name on the address.line1 : string Address line 1.line2 : string Address line 2. May be empty.zipcode : string Postal or ZIP code.city : string City.state : string State name.country : string 2-letter country code, for example, "in" for India.contact : string Phone number associated with this address.tag : string Address label, for example, "Home" or "Work".landmark : string Landmark. Empty string if not provided.
Server-assigned fields (id, entity_id, entity_type, primary, type) are absent because the address is not yet saved. Two additional form-specific fields are present:name : string Full name on the address.line1 : string Address line 1.line2 : string Address line 2. May be empty.zipcode : string Postal or ZIP code.city : string City.state : string State name.country : string 2-letter country code, for example, "in" for India.contact : string Phone number associated with this address.tag : string Address label, for example, "Home" or "Work".landmark : string Landmark. Empty string if not provided.save_my_address : boolean Indicates whether the customer opted to save this address.new_shipping_address_cta : any Internal form field.

Event Reference

Events are listed in the order they typically occur during a customer journey.
When it fires: The Magic Checkout modal opens.Additional fields: None beyond common fields.
Example Payload
When it fires: The customer enters their phone number or email address in the contact input field.Additional fields: None beyond common fields. The phone or email fields in the common payload reflect what the customer entered.
When it fires: An OTP is sent to the customer’s phone number.Additional fields:otp_verified : boolean Always false. The OTP is sent but not yet verified.
Example Payload
When it fires: The customer submits an OTP and it is accepted. This event does not fire on a failed OTP attempt.Additional fields:otp_verified : boolean Always true. This event fires only on successful verification.
Example Payload
When it fires: The customer skips the OTP verification step when the skip option is available.Additional fields: None beyond common fields.
When it fires: The customer’s identity is confirmed and their profile data is available. This is the earliest event where phone, email, first_name and last_name are reliably populated.This event fires multiple times in a session: at login completion, when the customer proceeds from the address step and when payment is initiated. Each emission reflects the most current customer data.Additional fields: None beyond common fields.
Example Payload

Event Behavior Notes

These events only fire for Magic Checkout. If Magic Checkout features are not enabled on your account, mx-analytics events will not be emitted.
Customer fields start as empty strings and are populated progressively as the customer advances through the flow. user_data is the earliest event where all identity fields are reliably complete.
user_data fires multiple times per session: at login confirmation, after address is confirmed and when payment is initiated.
payment_initiated and payment_failed can fire multiple times in one session if the customer retries after a failure.
otp_submitted only fires on a successful OTP. There is no event for a failed OTP attempt.
address_selected will not fire if the same address is selected twice. It only fires when the selection changes.
address_info_submitted fires in three scenarios: new address submitted, existing address confirmed and automatically on checkout open for an already-logged-in customer with a saved address.
shipping_selected fields (name, shipping_fee, cod, cod_fee, id) are absent in the quick-buy flow where the customer pays without going through an address step.
checkout_abandoned fires only when checkout closes without a successful payment. If payment succeeds, the handler callback fires instead.