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

# Using the Account Registration Button on Order Confirmation Pages

## Overview

The *Account Registration Button* allows guest shoppers who complete checkout through Global-e to register for your store account directly from the *Order Confirmation* page.

When the shopper clicks the button, Global-e passes customer and order details to your site via a JavaScript callback/postMessage. You then handle the registration flow, event tracking, and redirect on your side.

## Business Value

* Increase account registrations from first-time guest shoppers.
* Improve retention and repeat purchases.
* Maintain a seamless shopper experience—no redirects from Global-e, no checkout regressions.

## What Merchants Need to Do

1. **Step 1 – Enable the Feature**

   Request Global-e to enable the *“Registration Button on Confirmation Page”* in your MAS configuration.

   The button is only displayed for guest shoppers (non-signed-in users).
2. **Step 2 – Handle the Callback Event**

   Global-e sends a client-side event (`OnCustomerRegistration`) when the shopper clicks the button. You must listen to this event in your website’s parent page and implement a handler.

   ```
   // Define your registration handler
   const registrationHandler = function (data) {
       console.log('🎉 Customer Registration Event Received!');
       console.log('Registration Data:', data);

       // Example: access key fields
       console.log('Customer:', data.firstName, data.lastName);
       console.log('Email:', data.email);

       // Process data according to your needs:
       // 1. Redirect shopper to your registration page
       // 2. Pre-fill registration form fields
       // 3. Send event to analytics tools
       // 4. Store in your CRM / ERP if needed
   };

   // Register the handler in Global-e client SDK
   GlobalE.OnCustomerRegistration(registrationHandler);
   ```
3. **Step 3 – Process the Data**

   The callback contains customer, billing, and shipping details in JSON format.

   ```
   {
     "countryCode": "US",
     "firstName": "John",
     "lastName": "Smith",
     "email": "john.smith@example.com",
     "phoneNumber": "+1-555-123-4567",
     "billingAddress": {
       "BillingFirstName": "John",
       "BillingLastName": "Smith",
       "BillingAddress1": "123 Main Street",
       "BillingCity": "New York",
       "BillingZIP": "10001",
       "BillingCountryCode": "US"
     },
     "shippingAddress": {
       "ShippingFirstName": "John",
       "ShippingLastName": "Smith",
       "ShippingAddress1": "456 Oak Avenue",
       "ShippingCity": "Brooklyn",
       "ShippingZIP": "11201",
       "ShippingCountryCode": "US"
     }
   }
   ```

   Use this data to:

   * Pre-fill registration forms on your site.
   * Pass data to your customer account system.
   * Fire analytics/marketing events.
4. **Step 4 – Manage Redirect and Tracking**

   Global-e does not perform redirects. You are responsible for:

   * Redirecting shoppers to your registration page.
   * Implementing your own event tracking.
5. **Step 5 – Localization and Styling**

   Button text is localized via Global-e’s translation layer (`TR_REGISTER_FROM_CONFIRMATION`).

   UI style matches your confirmation page design automatically.

   No action is needed unless you want to apply custom CSS.

## Shopper Experience

1. Guest completes checkout.
2. On the Confirmation page, the shopper sees: **\[Create an Account]** button.
3. Shopper clicks button → `OnCustomerRegistration` event triggers.
4. Your site handles registration redirect and tracking.

## Merchant Checklist

| Task                                                | Who Handles | Notes              |
| --------------------------------------------------- | ----------- | ------------------ |
| Enable MAS setting for Registration Button          | Global-e    | One-time setup     |
| Implement event listener (`OnCustomerRegistration`) | Merchant    | Required           |
| Process customer and order data                     | Merchant    | Use payload fields |
| Redirect to registration                            | Merchant    | Required           |

## Example Use Cases

* **Pre-fill Registration Form**

  Shopper clicks the button → your form loads with name, email, and address already filled in.
* **Custom Redirect**

  Shopper is redirected to `/register?source=confirmation` with their email passed as a query parameter.

With this setup, you fully control shopper registration flow while leveraging Global-e checkout context.
