{"templateId":"markdown","sharedDataIds":{"sidebar":"sidebar-guides/sidebars.yaml"},"props":{"metadata":{"markdoc":{"tagList":["sub-heading","br","details","admonition"]},"type":"markdown"},"seo":{"title":"Events","description":"Transform your commerce with PXP's unified platform—seamless payments, real-time insights, and global growth in one powerful integration.","lang":"en-UK","siteUrl":"https://developer.pxp.io","llmstxt":{"hide":false,"sections":[{"title":"Table of contents","includeFiles":["**/*"],"excludeFiles":[]}],"excludeFiles":[]}},"dynamicMarkdocComponents":[],"compilationErrors":[],"ast":{"$$mdtype":"Tag","name":"article","attributes":{},"children":[{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"events","__idx":0},"children":["Events"]},{"$$mdtype":"Tag","name":"SubHeading","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Implement callbacks to customise your Paze payment flow for Web."]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"overview","__idx":1},"children":["Overview"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Components emit events based on user interaction or validation. You can use these to implement callback functions, which allow you to inject your own business logic and user experience customisations into the payment flow at critical moments. They ensure that while the SDK handles the complex technical aspects of payment processing, you retain full control over the customer experience and can seamlessly integrate payments into your broader business workflows and systems."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Callbacks enable you to:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Validate business rules before payments proceed."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Display custom error, failure, or success messages."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Tailor user interfaces to match your brand's look and feel."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Integrate with your own systems for fraud detection or customer management."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Control exactly how your customers experience both successful and failed transactions."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Handle Paze specific popup and decryption flow requirements."]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"sdk-data-callbacks","__idx":2},"children":["SDK data callbacks"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Configure these callbacks on ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["PxpCheckout.initialize()"]},", not on the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["paze-button"]}," component. They supply shopper and shipping data when the SDK builds the Unity transaction request after decryption."]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onGetShopper"]}," (recommended): Called during authorisation to retrieve shopper data for the transaction payload."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onGetShippingAddress"]}," (optional): Called during authorisation when you need shipping address data included in the transaction."]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["These callbacks ensure the Paze component always uses the latest customer data from your application state, forms, or APIs when submitting payments."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"ongetshopper","__idx":3},"children":["onGetShopper"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["This callback is recommended for most integrations. The SDK calls it optionally when building the transaction request, after decryption and before Unity authorisation."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["You can use it to:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Provide a stable shopper ID for your customer account or guest session."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Return the latest name, email, and contact details from your application."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Associate the Paze network-token transaction with your customer records."]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"configuration","__idx":4},"children":["Configuration"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Set ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onGetShopper"]}," on ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["PxpCheckout.initialize()"]},":"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"typescript","header":{"controls":{"copy":{}}},"source":"const pxpSdk = PxpCheckout.initialize({\n  environment: 'test',\n  session: { /* ... */ },\n  transactionData: { /* ... */ },\n  onGetShopper: async () => ({\n    id: 'shopper-123',\n    email: 'customer@example.com',\n    firstName: 'John',\n    lastName: 'Doe'\n  })\n});\n","lang":"typescript"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"event-data","__idx":5},"children":["Event data"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["This callback receives no parameters. It must return a ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Promise<Shopper>"]},"."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"return-value","__idx":6},"children":["Return value"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"align":"left","data-label":"Property"},"children":["Property"]},{"$$mdtype":"Tag","name":"th","attributes":{"align":"left","data-label":"Description"},"children":["Description"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["id"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["string"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["A unique shopper identifier. Use your customer account ID for logged-in users or a persistent session ID for guest checkout so transactions can be linked to your records."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["firstName"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["string"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["The shopper's given name, included in the transaction shopper profile sent to Unity."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["lastName"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["string"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["The shopper's family name, included in the transaction shopper profile sent to Unity."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["email"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["string"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["The shopper's email address for transaction records and customer correspondence."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["phoneNumber"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["string"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["A contact phone number for the shopper profile in the transaction request."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["dateOfBirth"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["string"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["The shopper's date of birth, when required by your integration or risk screening rules."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["houseNumberOrName"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["string"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["The first line of the shopper's address, such as a house number or building name, for profile data in the transaction."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["street"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["string"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["The street name or remaining address line for the shopper's profile data."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["city"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["string"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["The city or locality associated with the shopper's address."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["postalCode"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["string"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["The postal or ZIP code for the shopper's address."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["countryCode"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["string"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["A two-letter ISO 3166-1 alpha-2 country code for the shopper's address (for example, ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["\"US\""]},")."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["state"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["string"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["The state, province, or region for the shopper's address."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["products"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["object"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["A key-value metadata object describing products in the order, forwarded with the transaction shopper data."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["orderDescription"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["string"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["A human-readable description of the order included in the transaction shopper data."]}]}]}]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["All properties are optional in the type, but you should always return an ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["id"]}," so transactions can be linked to your customer records."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"example-implementation","__idx":7},"children":["Example implementation"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"typescript","header":{"controls":{"copy":{}}},"source":"onGetShopper: async () => {\n  const customer = await getCurrentCustomer();\n\n  if (customer) {\n    return {\n      id: customer.id,\n      email: customer.email,\n      firstName: customer.firstName,\n      lastName: customer.lastName,\n      phoneNumber: customer.phone\n    };\n  }\n\n  return {\n    id: getOrCreateGuestShopperId()\n  };\n}\n","lang":"typescript"},"children":[]},{"$$mdtype":"Tag","name":"Admonition","attributes":{"type":"info"},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Paze wallet identity (",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["emailAddress"]}," / ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["phoneNumber"]}," on the component) is separate from ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onGetShopper"]},". Component identity controls Paze presentment and checkout. ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onGetShopper"]}," supplies the shopper object sent to Unity during authorisation. When both ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["emailAddress"]}," and ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["phoneNumber"]}," are set on the component, only ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["phoneNumber"]}," is sent to Paze ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["checkout()"]}," (both are still used for dynamic ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["canCheckout()"]},")."]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"ongetshippingaddress","__idx":8},"children":["onGetShippingAddress"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["This callback is optional. When configured, the SDK calls it during authorisation and includes the returned address in the transaction request."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["You can use it to:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Include shipping address data for physical goods."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Pass fulfilment address details required by your backend or risk screening."]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"configuration-1","__idx":9},"children":["Configuration"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Set ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onGetShippingAddress"]}," on ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["PxpCheckout.initialize()"]}," alongside ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onGetShopper"]},":"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"typescript","header":{"controls":{"copy":{}}},"source":"const pxpSdk = PxpCheckout.initialize({\n  // ... session and transactionData\n  onGetShopper: async () => ({ id: 'shopper-123' }),\n  onGetShippingAddress: async () => ({\n    address: '123 Main St',\n    city: 'New York',\n    state: 'NY',\n    postalCode: '10001',\n    countryCode: 'US'\n  })\n});\n","lang":"typescript"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"event-data-1","__idx":10},"children":["Event data"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["This callback receives no parameters. It must return a ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Promise<ShippingAddress>"]},"."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"return-value-1","__idx":11},"children":["Return value"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"align":"left","data-label":"Property"},"children":["Property"]},{"$$mdtype":"Tag","name":"th","attributes":{"align":"left","data-label":"Description"},"children":["Description"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["address"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["string"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["The primary shipping street address. The SDK maps this value to ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["addressLine1"]}," in the transaction request."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["addressLine2"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["string"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["An additional shipping address detail, such as an apartment, suite, or unit number."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["city"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["string"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["The city or locality where the order will be delivered."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["state"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["string"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["The state, province, or region for the shipping destination."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["county"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["string"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["The county or district for the shipping destination, when applicable."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["postalCode"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["string"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["The postal or ZIP code for the shipping destination."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["countryCode"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["string"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["A two-letter ISO 3166-1 alpha-2 country code for the shipping destination (for example, ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["\"US\""]},")."]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"example-implementation-1","__idx":12},"children":["Example implementation"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"typescript","header":{"controls":{"copy":{}}},"source":"onGetShippingAddress: async () => {\n  const shipping = await getSelectedShippingAddress();\n\n  return {\n    address: shipping.line1,\n    addressLine2: shipping.line2,\n    city: shipping.city,\n    state: shipping.state,\n    postalCode: shipping.postalCode,\n    countryCode: shipping.countryCode\n  };\n}\n","lang":"typescript"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"paze-specific-events","__idx":13},"children":["Paze-specific events"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Configure these callbacks on ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["pxpSdk.create('paze-button', { ... })"]},". All Paze-specific events are optional and can be mixed and matched based on your business needs."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"callback-order","__idx":14},"children":["Callback order"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["For a successful payment, callbacks fire in this order:"]},{"$$mdtype":"Tag","name":"ol","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onInit"]},": after the Paze SDK initialises (before presentment resolves in dynamic mode)."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onPresentmentResolved"]},": after the button visibility is determined."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onCustomValidation"]}," → ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onPazeButtonClicked"]},": when the customer clicks the button."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onCheckoutComplete"]}," or ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onCheckoutIncomplete"]},": after the Paze ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["checkout()"]}," popup closes."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onComplete"]},": after Paze ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["complete()"]}," returns and the response is decoded."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onPreDecryption"]}," → ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onPostDecryption"]}," (if SDK decryption proceeds): decrypt secured payload."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onPreAuthorisation"]}," → Unity authorisation (the SDK calls ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onGetShopper"]}," and ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onGetShippingAddress"]}," here) → ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onPostAuthorisation"]}," (if configured)."]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onError"]}," handles init, load, checkout, complete, and decryption errors. ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onSubmitError"]}," handles authorisation submission failures."]},{"$$mdtype":"Tag","name":"Admonition","attributes":{"type":"info"},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["SDK initialisation callbacks (",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onGetShopper"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onGetShippingAddress"]},") are configured on ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["PxpCheckout.initialize()"]},". Paze component callbacks handle wallet popup interactions, decryption, and authorisation events."]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"oninit","__idx":15},"children":["onInit"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["This callback is triggered after the Paze SDK initialises for this component, before presentment resolves in dynamic mode."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["You can use it to:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Log that Paze has successfully initialised."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Enable UI elements that depend on Paze being ready."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Track SDK initialisation in your analytics."]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"event-data-2","__idx":16},"children":["Event data"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["This callback receives no parameters."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"example-implementation-2","__idx":17},"children":["Example implementation"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"typescript","header":{"controls":{"copy":{}}},"source":"onInit: () => {\n  console.log('Paze component initialised successfully');\n  \n  // Enable the Paze button in UI\n  enablePaymentButton('paze');\n  \n  // Track initialisation in analytics\n  trackEvent('paze-initialised', {\n    timestamp: new Date().toISOString()\n  });\n}\n","lang":"typescript"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"onpresentmentresolved","__idx":18},"children":["onPresentmentResolved"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["This callback is triggered after presentment resolves, indicating whether the Paze button is visible or hidden based on eligibility checks."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["You can use it to:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Show or hide alternative payment methods based on Paze availability."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Track how often Paze is presented to customers."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Adjust page layout when Paze is not available."]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"event-data-3","__idx":19},"children":["Event data"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Parameter"},"children":["Parameter"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Description"},"children":["Description"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["isVisible"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["boolean"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Indicates whether the Paze button is visible to the customer."]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"example-implementation-3","__idx":20},"children":["Example implementation"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"typescript","header":{"controls":{"copy":{}}},"source":"onPresentmentResolved: (isVisible) => {\n  console.log('Paze button visible:', isVisible);\n  \n  // Track presentment result\n  trackEvent('paze-presentment-resolved', {\n    isVisible: isVisible,\n    timestamp: new Date().toISOString()\n  });\n  \n  if (!isVisible) {\n    // Show alternative payment methods\n    showAlternativePaymentMethods();\n    console.log('Paze not available, showing alternatives');\n  } else {\n    // Optionally hide other less preferred methods\n    prioritisePazeButton();\n  }\n}\n","lang":"typescript"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"oncustomvalidation","__idx":21},"children":["onCustomValidation"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["This callback is triggered when the customer clicks the Paze button, ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["before"]}," the checkout popup opens. It runs before ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onPazeButtonClicked"]}," and before Paze's ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["checkout()"]}," is called."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["You can use it to:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Validate cart state, inventory, or order totals before checkout starts."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Enforce terms acceptance or other merchant business rules."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Block checkout from opening when prerequisites are not met."]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Return ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["true"]}," to allow checkout to proceed, or ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["false"]}," to prevent the Paze popup from opening."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"event-data-4","__idx":22},"children":["Event data"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["This callback receives no parameters."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"return-value-2","__idx":23},"children":["Return value"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"align":"left","data-label":"Return value"},"children":["Return value"]},{"$$mdtype":"Tag","name":"th","attributes":{"align":"left","data-label":"Behaviour"},"children":["Behaviour"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["true"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["Checkout proceeds to ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onPazeButtonClicked"]}," and the Paze popup."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["false"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["Checkout is cancelled. The Paze popup does not open."]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"example-implementation-4","__idx":24},"children":["Example implementation"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"typescript","header":{"controls":{"copy":{}}},"source":"onCustomValidation: async () => {\n  if (!cartHasItems()) {\n    showError('Your cart is empty.');\n    return false;\n  }\n\n  if (!termsAccepted()) {\n    showError('Please accept the terms and conditions.');\n    return false;\n  }\n\n  const inventoryAvailable = await checkInventoryAvailability();\n  if (!inventoryAvailable) {\n    showError('Some items are no longer available.');\n    return false;\n  }\n\n  return true;\n}\n","lang":"typescript"},"children":[]},{"$$mdtype":"Tag","name":"Admonition","attributes":{"type":"info"},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Use ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onCustomValidation"]}," for merchant-side checks that must pass before the Paze wallet opens. Use ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onCheckoutComplete"]}," to approve or reject checkout data after the shopper finishes in the Paze popup but before ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["complete()"]}," runs."]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"onpazebuttonclicked","__idx":25},"children":["onPazeButtonClicked"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["This callback is triggered after ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onCustomValidation"]}," passes, before the Paze ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["checkout()"]}," popup opens."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["You can use it to:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Clear UI state or error messages before starting checkout."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Show loading indicators."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Track button click events for analytics."]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"event-data-5","__idx":26},"children":["Event data"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Parameter"},"children":["Parameter"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Description"},"children":["Description"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["event"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["Event"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The native browser click event object."]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"example-implementation-5","__idx":27},"children":["Example implementation"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"typescript","header":{"controls":{"copy":{}}},"source":"onPazeButtonClicked: async (event) => {\n  console.log('Paze button clicked');\n  \n  // Show loading state\n  setLoading(true);\n  clearErrorMessages();\n  \n  // Track click event\n  trackEvent('paze-button-clicked', {\n    timestamp: new Date().toISOString(),\n    cartValue: getCurrentCartValue()\n  });\n}\n","lang":"typescript"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"oncheckoutcomplete","__idx":28},"children":["onCheckoutComplete"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["This callback is triggered after the Paze popup returns a ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["COMPLETE"]}," status, before the SDK calls Paze ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["complete()"]},"."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["You can use it to:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Validate the checkout result on your backend."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Perform business rule checks before proceeding."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Confirm order details with the customer."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Apply final price adjustments."]}]},{"$$mdtype":"Tag","name":"Admonition","attributes":{"type":"info"},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["If you omit this callback, the SDK treats checkout as approved and proceeds to ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["complete()"]},", decryption, and authorisation."]}]},{"$$mdtype":"Tag","name":"Admonition","attributes":{"type":"warning"},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Return ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["true"]}," to allow the SDK to proceed with ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["complete()"]},", decryption, and transaction submission. Return ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["false"]}," to cancel the flow; the SDK then calls ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onCheckoutIncomplete"]}," with reason ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["\"Merchant validation rejected completion.\""]},"."]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"event-data-6","__idx":29},"children":["Event data"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Parameter"},"children":["Parameter"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Description"},"children":["Description"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["result"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["PazeCheckoutResult"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Object containing checkout result data."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["result.result"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["string"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The checkout result status (",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["\"COMPLETE\""]}," or ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["\"INCOMPLETE\""]},")."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["result.checkoutResponse"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["string"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Present when ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["result"]}," is ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["\"COMPLETE\""]},". Encoded checkout response JWT."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["result.checkoutDecodedResponse"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["object"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Present when ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["result"]}," is ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["\"COMPLETE\""]},". Decoded checkout response containing consumer, session, and masked card data."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["result.reason"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["string"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Optional reason from Paze (may be present on ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["\"COMPLETE\""]}," or ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["\"INCOMPLETE\""]},")."]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"example-implementation-6","__idx":30},"children":["Example implementation"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"typescript","header":{"controls":{"copy":{}}},"source":"onCheckoutComplete: async (result) => {\n  console.log('Paze checkout completed:', result);\n  \n  try {\n    // Validate the checkout result on your backend\n    const isValid = await validateCheckoutResult({\n      sessionId: result.checkoutDecodedResponse.sessionId,\n      consumerEmail: result.checkoutDecodedResponse.consumer.emailAddress,\n      cardLast4: result.checkoutDecodedResponse.maskedCard.panLastFour\n    });\n    \n    if (!isValid) {\n      showError('Unable to validate checkout. Please try again.');\n      return false;\n    }\n    \n    // Check if customer is eligible for this payment method\n    const isEligible = await checkCustomerEligibility(\n      result.checkoutDecodedResponse.consumer.emailAddress\n    );\n    \n    if (!isEligible) {\n      showError('This payment method is not available for your account.');\n      return false;\n    }\n    \n    // Track successful checkout completion\n    trackEvent('paze-checkout-completed', {\n      sessionId: result.checkoutDecodedResponse.sessionId,\n      timestamp: new Date().toISOString()\n    });\n    \n    // Proceed with decryption and submission\n    return true;\n    \n  } catch (error) {\n    console.error('Checkout validation failed:', error);\n    showError('Unable to process payment. Please try again.');\n    return false;\n  }\n}\n","lang":"typescript"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"oncheckoutincomplete","__idx":31},"children":["onCheckoutIncomplete"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["This callback is triggered when the Paze checkout ends without completion or when the popup is closed by the customer."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["You can use it to:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Track abandonment rates for conversion optimisation."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Show helpful messages or alternative options."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Save the customer's cart for later completion."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Trigger email campaigns for abandoned checkouts."]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"event-data-7","__idx":32},"children":["Event data"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Parameter"},"children":["Parameter"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Description"},"children":["Description"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["result"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["PazeCheckoutResult"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Object containing checkout result data."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["result.result"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["string"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The checkout result status (",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["\"INCOMPLETE\""]},")."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["result.reason"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["string"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The reason for the incomplete checkout."]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"example-implementation-7","__idx":33},"children":["Example implementation"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"typescript","header":{"controls":{"copy":{}}},"source":"onCheckoutIncomplete: (result) => {\n  console.log('Paze checkout incomplete:', result);\n  \n  // Track abandonment for analytics\n  trackEvent('paze-checkout-abandoned', {\n    reason: result.reason || 'unknown',\n    timestamp: new Date().toISOString(),\n    cartValue: getCurrentCartValue()\n  });\n  \n  // Preserve cart for later\n  saveCartForLater();\n  \n  // Show context-appropriate message\n  // reason values come from Paze or the SDK (e.g. \"Merchant validation rejected completion.\")\n  if (result.reason?.toLowerCase().includes('cancel')) {\n    showMessage('No worries! Your items are saved. You can complete your purchase anytime.', 'info');\n  } else {\n    showMessage('Checkout was not completed. Please try again or use a different payment method.', 'warning');\n  }\n  \n  // Offer alternatives after a short delay\n  setTimeout(() => {\n    showAlternativePaymentOptions();\n  }, 2000);\n  \n  // Remove loading state\n  setLoading(false);\n}\n","lang":"typescript"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"oncomplete","__idx":34},"children":["onComplete"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["This callback is triggered when Paze ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["complete()"]}," returns successfully and the response JWT is decoded. It runs ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["before"]}," ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onPreDecryption"]}," and before any SDK decryption or authorisation."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["You can use it to:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Read ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["securedPayload"]}," from the decoded complete response."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Update UI with completion status."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Track that the Paze complete step succeeded in analytics."]}]},{"$$mdtype":"Tag","name":"Admonition","attributes":{"type":"info"},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["If ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onPreDecryption"]}," returns ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["false"]},", handle decryption manually using ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["result.completeDecodedResponse.securedPayload"]},". See ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/guides/checkout/components/web/paze/implementation#backend-decryption"},"children":["Backend decryption"]}," for the PXP decrypt-token API."]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"event-data-8","__idx":35},"children":["Event data"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Parameter"},"children":["Parameter"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Description"},"children":["Description"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["result"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["PazeCompleteResult"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Object containing the complete response data."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["result.completeResponse"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["string"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The encoded complete response JWT."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["result.completeDecodedResponse"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["object"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The decoded response containing ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["payloadId"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["sessionId"]},", and ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["securedPayload"]},"."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["result.completeDecodedResponse.securedPayload"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["string"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The JWE encrypted payload to be decrypted."]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"example-implementation-8","__idx":36},"children":["Example implementation"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"typescript","header":{"controls":{"copy":{}}},"source":"onComplete: async (result) => {\n  console.log('Paze complete flow finished');\n  console.log('Payload ID:', result.completeDecodedResponse?.payloadId);\n  console.log('Session ID:', result.completeDecodedResponse?.sessionId);\n  \n  // Track completion\n  trackEvent('paze-complete-flow-finished', {\n    payloadId: result.completeDecodedResponse?.payloadId,\n    sessionId: result.completeDecodedResponse?.sessionId,\n    timestamp: new Date().toISOString()\n  });\n  \n  // If handling decryption manually (when onPreDecryption returns false)\n  // Use result.completeDecodedResponse?.securedPayload on your backend\n}\n","lang":"typescript"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"onpredecryption","__idx":37},"children":["onPreDecryption"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["This callback is triggered after ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onComplete"]},", before the SDK calls Unity to decrypt the secured payload."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["You can use it to:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Request merchant operator approval for high-value transactions."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Perform additional security checks."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Control whether decryption should proceed."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Handle decryption manually on your backend."]}]},{"$$mdtype":"Tag","name":"Admonition","attributes":{"type":"warning"},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Return ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["true"]}," to allow the SDK to decrypt and continue the built-in flow. Return ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["false"]}," to abort SDK decryption and handle it yourself."]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"event-data-9","__idx":38},"children":["Event data"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["This callback receives no parameters."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"example-implementation-9","__idx":39},"children":["Example implementation"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["To allow SDK to handle decryption:"]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"typescript","header":{"controls":{"copy":{}}},"source":"onPreDecryption: async () => {\n  console.log('Pre-decryption check');\n  \n  // Optional: Check transaction amount or other criteria\n  const cartValue = getCurrentCartValue();\n  \n  if (cartValue > 1000) {\n    // Request approval for high-value transactions\n    const approved = await requestManagerApproval({\n      amount: cartValue,\n      timestamp: new Date().toISOString()\n    });\n    \n    if (!approved) {\n      showError('Transaction requires manager approval');\n      return false;\n    }\n  }\n  \n  // Allow SDK to proceed with decryption\n  return true;\n}\n","lang":"typescript"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["To handle decryption manually:"]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"typescript","header":{"controls":{"copy":{}}},"source":"onPreDecryption: async () => {\n  console.log('Preventing SDK decryption - will handle manually');\n  \n  // Return false to prevent SDK from decrypting\n  // Handle decryption in onComplete callback instead\n  return false;\n}\n","lang":"typescript"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"onpostdecryption","__idx":40},"children":["onPostDecryption"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["This callback is triggered after Unity successfully decrypts the network token."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["You can use it to:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Log masked token details for debugging."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Store card information for display purposes."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Update UI with payment method details."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Validate decrypted token before proceeding."]}]},{"$$mdtype":"Tag","name":"Admonition","attributes":{"type":"info"},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["This callback is only triggered if ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onPreDecryption"]}," returns ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["true"]}," (SDK-managed decryption)."]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"event-data-10","__idx":41},"children":["Event data"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Parameter"},"children":["Parameter"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Description"},"children":["Description"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["decryptedPayload"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["PazeDecryptTokenResponse"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The decrypted token response from Unity."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["decryptedPayload.shopper"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["object"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Customer information (name, email, phone, country, language)."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["decryptedPayload.billingAddress"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["object"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Optional billing address (address line, city, state, country code, postal code)."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["decryptedPayload.fundingData"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["object"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Network token data (token, expiry, account reference, card network, token usage type, dynamic data expiration)."]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"example-implementation-10","__idx":42},"children":["Example implementation"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"typescript","header":{"controls":{"copy":{}}},"source":"onPostDecryption: async (decryptedPayload) => {\n  console.log('Token decrypted successfully');\n  \n  // Log masked token for debugging (first 6 and last 4 digits only)\n  const maskedToken = decryptedPayload.fundingData.networkToken.slice(0, 6) + \n                      '...' + \n                      decryptedPayload.fundingData.networkToken.slice(-4);\n  console.log('Masked network token:', maskedToken);\n  console.log('Card network:', decryptedPayload.fundingData.cardNetwork);\n  console.log('Expiry:', `${decryptedPayload.fundingData.expirationMonth}/${decryptedPayload.fundingData.expirationYear}`);\n  \n  // Store masked card details for display\n  saveMaskedCardDetails({\n    network: decryptedPayload.fundingData.cardNetwork,\n    lastFour: decryptedPayload.fundingData.networkToken.slice(-4),\n    expiry: `${decryptedPayload.fundingData.expirationMonth}/${decryptedPayload.fundingData.expirationYear}`\n  });\n  \n  // Update UI with shopper information\n  displayShopperInfo({\n    name: decryptedPayload.shopper.fullName,\n    email: decryptedPayload.shopper.emailAddress,\n    postalCode: decryptedPayload.billingAddress?.postalCode\n  });\n  \n  // Track successful decryption\n  trackEvent('paze-decryption-completed', {\n    cardNetwork: decryptedPayload.fundingData.cardNetwork,\n    timestamp: new Date().toISOString()\n  });\n}\n","lang":"typescript"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"onpreauthorisation","__idx":43},"children":["onPreAuthorisation"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["This callback is triggered before the transaction is submitted to Unity."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["You can use it to:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Integrate with Kount or other fraud detection services."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Perform AVS (Address Verification System) checks."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Apply business rules based on transaction amount or customer history."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Include additional risk screening data."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Abort the transaction if needed."]}]},{"$$mdtype":"Tag","name":"Admonition","attributes":{"type":"info"},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Return ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["false"]}," to abort the transaction. Return ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["true"]}," or ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["null"]}," to proceed without extra data. Return a ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["PazeTransactionInitData"]}," object with ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["riskScreeningData"]}," to include fraud detection data in the transaction request."]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"event-data-11","__idx":44},"children":["Event data"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["This callback receives no parameters."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"example-implementation-11","__idx":45},"children":["Example implementation"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["To proceed with basic authorisation:"]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"typescript","header":{"controls":{"copy":{}}},"source":"onPreAuthorisation: async () => {\n  console.log('Pre-authorisation check');\n  \n  // Perform basic checks\n  const isValid = await validateOrderDetails();\n  \n  if (!isValid) {\n    showError('Order validation failed');\n    return false; // Abort transaction\n  }\n  \n  // Proceed with authorisation\n  return true;\n}\n","lang":"typescript"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["To include risk screening data:"]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"typescript","header":{"controls":{"copy":{}}},"source":"onPreAuthorisation: async () => {\n  console.log('Including risk screening data');\n  \n  const customerData = await getCustomerData();\n  const orderItems = await getOrderItems();\n  const shippingAddress = await getShippingAddress();\n  \n  return {\n    riskScreeningData: {\n      performRiskScreening: true,\n      userIp: await getUserIpAddress(),\n      account: {\n        id: customerData.id,\n        creationDateTime: customerData.createdAt\n      },\n      items: orderItems.map(item => ({\n        price: item.price,\n        quantity: item.quantity,\n        category: item.category,\n        sku: item.sku\n      })),\n      fulfillments: [{\n        type: \"Shipped\",\n        shipping: {\n          shippingMethod: \"Standard\"\n        },\n        recipientPerson: {\n          phoneNumber: customerData.phone,\n          email: customerData.email,\n          address: {\n            line1: shippingAddress.street,\n            city: shippingAddress.city,\n            region: shippingAddress.state,\n            countryCode: shippingAddress.countryCode,\n            postalCode: shippingAddress.postalCode\n          }\n        }\n      }],\n      transaction: {\n        subtotal: orderItems.reduce((sum, item) => sum + (item.price * item.quantity), 0)\n      }\n    }\n  };\n}\n","lang":"typescript"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"onpostauthorisation","__idx":46},"children":["onPostAuthorisation"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["This callback is triggered after Unity returns a successful HTTP response for the transaction submission. Configure it on the component to receive transaction results; if omitted, the SDK does not call it."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The callback receives authorised, declined, and other non-failure states. HTTP or validation failures route to ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onSubmitError"]}," instead."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["You can use it to:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Retrieve full authorisation result from your backend using the transaction identifiers."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Redirect customers to a success page with order confirmation."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Update stock levels for purchased items."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Send order confirmation emails to customers."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Record successful transactions for business intelligence."]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"event-data-12","__idx":47},"children":["Event data"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Parameter"},"children":["Parameter"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Description"},"children":["Description"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["data"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["PazePostAuthorisationData"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Object containing transaction result data."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["data.merchantTransactionId"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["string"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Your unique identifier for the transaction."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["data.systemTransactionId"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["string"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The Unity system transaction identifier."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["data.networkToken"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["string"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The network token used for the transaction."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["data.providerResponseCode"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["string"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Optional provider response code."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["data.state"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["string"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Optional transaction state (e.g. ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["\"Authorised\""]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["\"Declined\""]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["\"Error\""]},")."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["data.stateDataCode"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["string"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Optional additional state information code."]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"example-implementation-12","__idx":48},"children":["Example implementation"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"typescript","header":{"controls":{"copy":{}}},"source":"onPostAuthorisation: async (data) => {\n  console.log('Payment authorisation completed');\n  console.log('Merchant Transaction ID:', data.merchantTransactionId);\n  console.log('System Transaction ID:', data.systemTransactionId);\n  console.log('Transaction State:', data.state);\n  \n  try {\n    // Retrieve full transaction details from your backend\n    const transactionResult = await getTransactionResult(\n      data.merchantTransactionId,\n      data.systemTransactionId\n    );\n    \n    if (data.state === 'Authorised') {\n      // Update inventory\n      await updateInventory(data.merchantTransactionId);\n      \n      // Send confirmation email\n      await sendOrderConfirmation({\n        transactionId: data.merchantTransactionId,\n        systemTransactionId: data.systemTransactionId,\n        amount: transactionResult.amount\n      });\n      \n      // Track successful purchase\n      trackEvent('paze-purchase-completed', {\n        transactionId: data.merchantTransactionId,\n        amount: transactionResult.amount,\n        timestamp: new Date().toISOString()\n      });\n      \n      // Redirect to success page\n      window.location.href = `/payment-success?txn=${data.merchantTransactionId}`;\n      \n    } else if (data.state === 'Declined') {\n      console.error('Payment declined:', data.providerResponseCode);\n      showErrorMessage('Payment declined. Please try again or use a different payment method.');\n      setLoading(false);\n      \n    } else {\n      console.error('Unexpected payment state:', data.state);\n      showErrorMessage('Payment processing error. Please contact support if charged.');\n      setLoading(false);\n    }\n    \n  } catch (error) {\n    console.error('Failed to process post-authorisation:', error);\n    showErrorMessage('Unable to confirm payment status. Please contact support.');\n    setLoading(false);\n  }\n}\n","lang":"typescript"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"onsubmiterror","__idx":49},"children":["onSubmitError"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["This callback is triggered when transaction submission or pre-submit validation fails."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["You can use it to:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Log errors for debugging and support."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Display user-friendly error messages."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Offer alternative payment methods."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Report errors to your monitoring system."]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"event-data-13","__idx":50},"children":["Event data"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The callback receives one of:"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"align":"left","data-label":"Type"},"children":["Type"]},{"$$mdtype":"Tag","name":"th","attributes":{"align":"left","data-label":"When"},"children":["When"]},{"$$mdtype":"Tag","name":"th","attributes":{"align":"left","data-label":"Key fields"},"children":["Key fields"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["FailedSubmitResult"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["Risk screening validation fails before submit, or Unity returns an HTTP error response"]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["errorCode"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["errorReason"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["correlationId"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["httpStatusCode"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["details"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["PazeTransactionFailedException"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["Unity returns a failed transaction response"]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["ErrorCode"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["message"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["submitResult"]}," (",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["FailedSubmitResult"]},")"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["BaseSdkException"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["Other authorisation errors"]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["ErrorCode"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["message"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["details"]}]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"example-implementation-13","__idx":51},"children":["Example implementation"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"typescript","header":{"controls":{"copy":{}}},"source":"onSubmitError: async (submitError) => {\n  console.error('Transaction submission failed:', submitError);\n\n  // PazeTransactionFailedException wraps FailedSubmitResult\n  if ('submitResult' in submitError) {\n    const failed = submitError.submitResult;\n    logErrorToMonitoring({\n      errorCode: failed.errorCode,\n      errorReason: failed.errorReason,\n      correlationId: failed.correlationId,\n      httpStatusCode: failed.httpStatusCode\n    });\n    showSupportInfo(`Reference: ${failed.correlationId}`);\n    showErrorMessage('Payment failed. Please try again.');\n    return;\n  }\n\n  // FailedSubmitResult (e.g. risk screening validation)\n  if ('errorCode' in submitError && 'errorReason' in submitError) {\n    showErrorMessage(submitError.errorReason);\n    return;\n  }\n\n  // BaseSdkException\n  showErrorMessage(submitError.message);\n  logErrorToMonitoring({\n    errorCode: submitError.ErrorCode,\n    message: submitError.message\n  });\n\n  setLoading(false);\n}\n","lang":"typescript"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"onerror","__idx":52},"children":["onError"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["This callback is triggered when SDK, presentment, checkout, complete, or decryption errors occur (initialisation, script load, popup failures, and similar)."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["You can use it to:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Log errors for debugging and monitoring."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Display user-friendly error messages."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Offer alternative payment methods."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Report critical errors to support."]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"event-data-14","__idx":53},"children":["Event data"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Parameter"},"children":["Parameter"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Description"},"children":["Description"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["error"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["BaseSdkException"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The error object containing details."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["error.ErrorCode"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["string"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The SDK error code."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["error.message"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["string"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Human-readable error description."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["error.details"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["any"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Additional error details (optional)."]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"example-implementation-14","__idx":54},"children":["Example implementation"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"typescript","header":{"controls":{"copy":{}}},"source":"onError: (error) => {\n  console.error('Paze SDK error:', error);\n  \n  // Log error for debugging\n  logError('paze-sdk-error', {\n    errorCode: error.ErrorCode,\n    message: error.message,\n    details: error.details,\n    timestamp: new Date().toISOString()\n  });\n  \n  // Handle different error types\n  let userMessage = 'Payment setup failed. Please try again.';\n  \n  if (error.message.includes('initialization') || error.message.includes('initialisation')) {\n    userMessage = 'Unable to initialise payment method. Please refresh the page.';\n    notifySupport('Paze initialization failed', error);\n  } else if (error.message.includes('Network') || error.message.includes('timeout')) {\n    userMessage = 'Network error. Please check your connection and try again.';\n  } else if (error.message.includes('popup') || error.message.includes('blocked')) {\n    userMessage = 'Popup was blocked. Please allow popups for this site and try again.';\n  } else if (error.message.includes('configuration')) {\n    userMessage = 'Payment system configuration error. Please contact support.';\n    notifySupport('Paze configuration error', error);\n  }\n  \n  showErrorMessage(userMessage);\n  \n  // Track error in analytics\n  trackEvent('paze-error', {\n    errorCode: error.ErrorCode,\n    errorType: error.message,\n    timestamp: new Date().toISOString()\n  });\n  \n  // Show alternative payment options\n  showAlternativePaymentMethods();\n}\n","lang":"typescript"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"event-data-structures","__idx":55},"children":["Event data structures"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"shopper","__idx":56},"children":["Shopper"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The object returned by ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onGetShopper"]},":"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"typescript","header":{"controls":{"copy":{}}},"source":"interface Shopper {\n  id?: string;\n  firstName?: string;\n  lastName?: string;\n  dateOfBirth?: string;\n  email?: string;\n  phoneNumber?: string;\n  houseNumberOrName?: string;\n  street?: string;\n  city?: string;\n  postalCode?: string;\n  countryCode?: string;\n  state?: string;\n  products?: Record<string, string>;\n  orderDescription?: string;\n}\n","lang":"typescript"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"shippingaddress","__idx":57},"children":["ShippingAddress"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The object returned by ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onGetShippingAddress"]},":"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"typescript","header":{"controls":{"copy":{}}},"source":"interface ShippingAddress {\n  countryCode?: string;\n  postalCode?: string;\n  address?: string;\n  addressLine2?: string;\n  city?: string;\n  county?: string;\n  state?: string;\n}\n","lang":"typescript"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"pazecheckoutresult","__idx":58},"children":["PazeCheckoutResult"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The checkout result object passed to ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onCheckoutComplete"]}," and ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onCheckoutIncomplete"]},":"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"typescript","header":{"controls":{"copy":{}}},"source":"interface PazeCheckoutResult {\n  result: \"COMPLETE\" | \"INCOMPLETE\";\n  checkoutResponse?: string;\n  reason?: string;\n  checkoutDecodedResponse?: {\n    sessionId?: string;\n    consumer: {\n      fullName: string;\n      firstName: string;\n      lastName: string;\n      emailAddress: string;\n      mobileNumber: PazePhoneNumber | null;\n      countryCode: string;\n      languageCode: string;\n    };\n    maskedCard: {\n      digitalCardId: string;\n      panLastFour: string;\n      paymentAccountReference: string;\n      panExpirationMonth: string;\n      panExpirationYear: string;\n      paymentCardDescriptor: string;\n      paymentCardType: string;\n      paymentCardBrand: string;\n      paymentCardNetwork: string;\n      digitalCardData: PazeDigitalCardData;\n      billingAddress: PazeCheckoutAddress;\n    };\n  };\n}\n","lang":"typescript"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["checkoutDecodedResponse"]}," is only populated when ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["result"]}," is ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["\"COMPLETE\""]},"."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"pazecompleteresult","__idx":59},"children":["PazeCompleteResult"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The complete result object passed to ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onComplete"]},":"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"typescript","header":{"controls":{"copy":{}}},"source":"interface PazeCompleteResult {\n  completeResponse: string;\n  completeDecodedResponse?: {\n    payloadId: string;\n    sessionId?: string;\n    securedPayload?: string;\n  };\n}\n","lang":"typescript"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["decryptedPayload"]}," is not populated on ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onComplete"]},". Decrypted token data is passed to ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onPostDecryption"]}," when SDK decryption proceeds."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"pazedecrypttokenresponse","__idx":60},"children":["PazeDecryptTokenResponse"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The decrypted token response passed to ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onPostDecryption"]},":"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"typescript","header":{"controls":{"copy":{}}},"source":"interface PazeDecryptTokenResponse {\n  shopper: {\n    firstName?: string;\n    lastName?: string;\n    fullName: string;\n    emailAddress: string;\n    phoneCountryCode?: string;\n    phoneNumber?: string;\n    countryCode?: string;\n    languageCode?: string;\n  };\n  billingAddress?: {\n    addressLine1: string;\n    city: string;\n    state: string;\n    countryCode: string;\n    postalCode: string;\n  };\n  fundingData: {\n    networkToken: string;\n    expirationMonth: string;\n    expirationYear: string;\n    accountReference?: string;\n    cardNetwork: string;\n    tokenUsageType?: string;\n    dynamicDataExpiration?: string;\n  };\n}\n","lang":"typescript"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"pazepostauthorisationdata","__idx":61},"children":["PazePostAuthorisationData"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The authorisation data passed to ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onPostAuthorisation"]},":"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"typescript","header":{"controls":{"copy":{}}},"source":"interface PazePostAuthorisationData {\n  merchantTransactionId: string;\n  systemTransactionId: string;\n  networkToken: string;\n  providerResponseCode?: string;\n  state?: string;\n  stateDataCode?: string;\n}\n","lang":"typescript"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"onsubmiterror-payload-types","__idx":62},"children":["onSubmitError payload types"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onSubmitError"]}," may receive ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["FailedSubmitResult"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["PazeTransactionFailedException"]}," (with a ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["submitResult"]}," property), or ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["BaseSdkException"]},". See the ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#onsubmiterror"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onSubmitError"]}]}," section above."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"failedsubmitresult","__idx":63},"children":["FailedSubmitResult"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Used for HTTP submission failures and validation errors before submit:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"typescript","header":{"controls":{"copy":{}}},"source":"interface FailedSubmitResult {\n  errorCode: string;\n  errorReason: string;\n  correlationId: string;\n  httpStatusCode: number;\n  details: any[];\n}\n","lang":"typescript"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"basesdkexception","__idx":64},"children":["BaseSdkException"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The error data passed to ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onError"]},":"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"typescript","header":{"controls":{"copy":{}}},"source":"interface BaseSdkException {\n  ErrorCode: string;\n  message: string;\n  details?: any;\n}\n","lang":"typescript"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"error-handling-in-events","__idx":65},"children":["Error handling in events"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Event callbacks should handle errors gracefully and provide appropriate feedback to customers:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"typescript","header":{"controls":{"copy":{}}},"source":"const pazeConfig = {\n  onCheckoutComplete: async (result) => {\n    try {\n      // Validate checkout result\n      const isValid = await validateCheckout(result);\n      \n      if (!isValid) {\n        showError('Checkout validation failed');\n        return false;\n      }\n      \n      return true;\n      \n    } catch (error) {\n      console.error('Checkout validation error:', error);\n      showError('Unable to validate checkout. Please try again.');\n      return false;\n    }\n  },\n  \n  onPostAuthorisation: async (data) => {\n    try {\n      // Retrieve transaction details from backend\n      const result = await getTransactionResult(\n        data.merchantTransactionId,\n        data.systemTransactionId\n      );\n      \n      if (data.state === 'Authorised') {\n        // Process successful payment\n        await processSuccessfulPayment(data);\n        window.location.href = `/payment-success?txn=${data.merchantTransactionId}`;\n      } else {\n        showErrorMessage('Payment was not authorised. Please try again.');\n      }\n      \n    } catch (error) {\n      console.error('Failed to retrieve transaction result:', error);\n      showErrorMessage('Unable to confirm payment status. Please contact support.');\n    }\n  },\n  \n  onSubmitError: async (submitError) => {\n    console.error('Transaction submission failed:', submitError);\n\n    if ('submitResult' in submitError) {\n      showErrorMessage(submitError.submitResult.errorReason);\n    } else if ('errorCode' in submitError) {\n      showErrorMessage(submitError.errorReason);\n    } else {\n      showErrorMessage(submitError.message);\n    }\n\n    setLoading(false);\n  },\n  \n  onError: (error) => {\n    console.error('Paze SDK error:', error);\n    \n    // Log for debugging\n    logError('paze-error', error);\n    \n    // Show appropriate message\n    if (error.message.includes('popup')) {\n      showErrorMessage('Please allow popups for this site and try again.');\n    } else if (error.message.includes('initialization')) {\n      showErrorMessage('Unable to initialise payment method. Please refresh the page.');\n    } else {\n      showErrorMessage('Payment setup failed. Please try again or use a different payment method.');\n    }\n  }\n};\n","lang":"typescript"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"advanced-event-usage","__idx":66},"children":["Advanced event usage"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"handling-decryption-manually","__idx":67},"children":["Handling decryption manually"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["If you need to decrypt the secured payload on your own backend instead of using the SDK's built-in decryption, see ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/guides/checkout/components/web/paze/implementation#backend-decryption"},"children":["Backend decryption"]}," for the PXP decrypt-token API."]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"typescript","header":{"controls":{"copy":{}}},"source":"const pazeConfig = {\n  // Prevent SDK from decrypting\n  onPreDecryption: async () => {\n    console.log('Handling decryption manually');\n    return false;\n  },\n  \n  // Handle secured payload in onComplete\n  onComplete: async (result) => {\n    const securedPayload = result.completeDecodedResponse?.securedPayload;\n    \n    try {\n      // Forward securedPayload to your backend (never decrypt in the browser)\n      const decryptedData = await fetch('/api/paze/decrypt', {\n        method: 'POST',\n        headers: { 'Content-Type': 'application/json' },\n        body: JSON.stringify({ securedPayload })\n      }).then(r => r.json());\n      \n      // Use decrypted data to submit transaction\n      const transactionResult = await submitTransaction(decryptedData);\n      \n      if (transactionResult.success) {\n        window.location.href = `/payment-success?txn=${transactionResult.transactionId}`;\n      } else {\n        showErrorMessage('Transaction failed. Please try again.');\n      }\n      \n    } catch (error) {\n      console.error('Manual decryption failed:', error);\n      showErrorMessage('Payment processing failed. Please try again.');\n    }\n  }\n};\n","lang":"typescript"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"fraud-detection-integration","__idx":68},"children":["Fraud detection integration"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Integrate with fraud detection services in the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onPreAuthorisation"]}," callback:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"typescript","header":{"controls":{"copy":{}}},"source":"onPreAuthorisation: async () => {\n  console.log('Performing fraud checks');\n  \n  try {\n    const customerData = await getCustomerData();\n    const orderData = await getOrderData();\n    const shippingAddress = await getShippingAddress();\n    \n    // Optional merchant-side fraud check before submit\n    const fraudScore = await checkFraudScore({\n      customerId: customerData.id,\n      orderValue: orderData.total\n    });\n    \n    if (fraudScore > 70) {\n      showErrorMessage('We were unable to process your payment. Please contact support.');\n      return false;\n    }\n    \n    return {\n      riskScreeningData: {\n        performRiskScreening: true,\n        userIp: await getUserIpAddress(),\n        account: {\n          id: customerData.id,\n          creationDateTime: customerData.createdAt\n        },\n        items: orderData.items.map(item => ({\n          price: item.price,\n          quantity: item.quantity,\n          category: item.category,\n          sku: item.sku\n        })),\n        fulfillments: [{\n          type: 'Shipped',\n          shipping: {\n            shippingMethod: orderData.shippingMethod\n          },\n          recipientPerson: {\n            name: {\n              first: customerData.firstName,\n              family: customerData.lastName\n            },\n            email: customerData.email,\n            phoneNumber: customerData.phone,\n            address: {\n              line1: shippingAddress.street,\n              city: shippingAddress.city,\n              region: shippingAddress.state,\n              countryCode: shippingAddress.countryCode,\n              postalCode: shippingAddress.postalCode\n            }\n          }\n        }],\n        transaction: {\n          subtotal: orderData.subtotal\n        }\n      }\n    };\n    \n  } catch (error) {\n    console.error('Fraud check failed:', error);\n    logError('fraud-check-failed', error);\n    return true;\n  }\n}\n","lang":"typescript"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"analytics-tracking","__idx":69},"children":["Analytics tracking"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Track Paze events comprehensively for business intelligence:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"typescript","header":{"controls":{"copy":{}}},"source":"const pazeConfig = {\n  onInit: () => {\n    trackEvent('paze_initialized', {\n      timestamp: new Date().toISOString()\n    });\n  },\n  \n  onPresentmentResolved: (isVisible) => {\n    trackEvent('paze_presentment_resolved', {\n      is_visible: isVisible,\n      timestamp: new Date().toISOString()\n    });\n  },\n\n  onCustomValidation: async () => {\n    return cartHasItems() && termsAccepted();\n  },\n  \n  onPazeButtonClicked: async (event) => {\n    trackEvent('paze_button_clicked', {\n      cart_value: getCurrentCartValue(),\n      cart_items: getCartItemCount(),\n      timestamp: new Date().toISOString()\n    });\n  },\n  \n  onCheckoutComplete: async (result) => {\n    trackEvent('paze_checkout_completed', {\n      session_id: result.checkoutDecodedResponse.sessionId,\n      card_network: result.checkoutDecodedResponse.maskedCard.paymentCardNetwork,\n      timestamp: new Date().toISOString()\n    });\n    return true;\n  },\n  \n  onCheckoutIncomplete: (result) => {\n    trackEvent('paze_checkout_abandoned', {\n      reason: result.reason,\n      cart_value: getCurrentCartValue(),\n      timestamp: new Date().toISOString()\n    });\n  },\n  \n  onPostAuthorisation: async (data) => {\n    trackEvent('paze_payment_completed', {\n      merchant_transaction_id: data.merchantTransactionId,\n      system_transaction_id: data.systemTransactionId,\n      state: data.state,\n      timestamp: new Date().toISOString()\n    });\n    \n    // Process payment...\n  },\n  \n  onSubmitError: async (submitError) => {\n    const errorCode = 'submitResult' in submitError\n      ? submitError.submitResult.errorCode\n      : 'errorCode' in submitError\n        ? submitError.errorCode\n        : submitError.ErrorCode;\n\n    trackEvent('paze_payment_failed', {\n      error_code: errorCode,\n      timestamp: new Date().toISOString()\n    });\n  }\n};\n","lang":"typescript"},"children":[]}]},"headings":[{"value":"Events","id":"events","depth":1},{"value":"Overview","id":"overview","depth":2},{"value":"SDK data callbacks","id":"sdk-data-callbacks","depth":2},{"value":"onGetShopper","id":"ongetshopper","depth":3},{"value":"Configuration","id":"configuration","depth":4},{"value":"Event data","id":"event-data","depth":4},{"value":"Return value","id":"return-value","depth":4},{"value":"Example implementation","id":"example-implementation","depth":4},{"value":"onGetShippingAddress","id":"ongetshippingaddress","depth":3},{"value":"Configuration","id":"configuration-1","depth":4},{"value":"Event data","id":"event-data-1","depth":4},{"value":"Return value","id":"return-value-1","depth":4},{"value":"Example implementation","id":"example-implementation-1","depth":4},{"value":"Paze-specific events","id":"paze-specific-events","depth":2},{"value":"Callback order","id":"callback-order","depth":3},{"value":"onInit","id":"oninit","depth":3},{"value":"Event data","id":"event-data-2","depth":4},{"value":"Example implementation","id":"example-implementation-2","depth":4},{"value":"onPresentmentResolved","id":"onpresentmentresolved","depth":3},{"value":"Event data","id":"event-data-3","depth":4},{"value":"Example implementation","id":"example-implementation-3","depth":4},{"value":"onCustomValidation","id":"oncustomvalidation","depth":3},{"value":"Event data","id":"event-data-4","depth":4},{"value":"Return value","id":"return-value-2","depth":4},{"value":"Example implementation","id":"example-implementation-4","depth":4},{"value":"onPazeButtonClicked","id":"onpazebuttonclicked","depth":3},{"value":"Event data","id":"event-data-5","depth":4},{"value":"Example implementation","id":"example-implementation-5","depth":4},{"value":"onCheckoutComplete","id":"oncheckoutcomplete","depth":3},{"value":"Event data","id":"event-data-6","depth":4},{"value":"Example implementation","id":"example-implementation-6","depth":4},{"value":"onCheckoutIncomplete","id":"oncheckoutincomplete","depth":3},{"value":"Event data","id":"event-data-7","depth":4},{"value":"Example implementation","id":"example-implementation-7","depth":4},{"value":"onComplete","id":"oncomplete","depth":3},{"value":"Event data","id":"event-data-8","depth":4},{"value":"Example implementation","id":"example-implementation-8","depth":4},{"value":"onPreDecryption","id":"onpredecryption","depth":3},{"value":"Event data","id":"event-data-9","depth":4},{"value":"Example implementation","id":"example-implementation-9","depth":4},{"value":"onPostDecryption","id":"onpostdecryption","depth":3},{"value":"Event data","id":"event-data-10","depth":4},{"value":"Example implementation","id":"example-implementation-10","depth":4},{"value":"onPreAuthorisation","id":"onpreauthorisation","depth":3},{"value":"Event data","id":"event-data-11","depth":4},{"value":"Example implementation","id":"example-implementation-11","depth":4},{"value":"onPostAuthorisation","id":"onpostauthorisation","depth":3},{"value":"Event data","id":"event-data-12","depth":4},{"value":"Example implementation","id":"example-implementation-12","depth":4},{"value":"onSubmitError","id":"onsubmiterror","depth":3},{"value":"Event data","id":"event-data-13","depth":4},{"value":"Example implementation","id":"example-implementation-13","depth":4},{"value":"onError","id":"onerror","depth":3},{"value":"Event data","id":"event-data-14","depth":4},{"value":"Example implementation","id":"example-implementation-14","depth":4},{"value":"Event data structures","id":"event-data-structures","depth":2},{"value":"Shopper","id":"shopper","depth":3},{"value":"ShippingAddress","id":"shippingaddress","depth":3},{"value":"PazeCheckoutResult","id":"pazecheckoutresult","depth":3},{"value":"PazeCompleteResult","id":"pazecompleteresult","depth":3},{"value":"PazeDecryptTokenResponse","id":"pazedecrypttokenresponse","depth":3},{"value":"PazePostAuthorisationData","id":"pazepostauthorisationdata","depth":3},{"value":"onSubmitError payload types","id":"onsubmiterror-payload-types","depth":3},{"value":"FailedSubmitResult","id":"failedsubmitresult","depth":3},{"value":"BaseSdkException","id":"basesdkexception","depth":3},{"value":"Error handling in events","id":"error-handling-in-events","depth":2},{"value":"Advanced event usage","id":"advanced-event-usage","depth":2},{"value":"Handling decryption manually","id":"handling-decryption-manually","depth":3},{"value":"Fraud detection integration","id":"fraud-detection-integration","depth":3},{"value":"Analytics tracking","id":"analytics-tracking","depth":3}],"frontmatter":{"seo":{"title":"Events"}},"lastModified":"2026-06-22T14:49:35.000Z","pagePropGetterError":{"message":"","name":""}},"slug":"/guides/checkout/components/web/paze/events","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}