Customer Screen In-App Integration

Option 1: Using Your Own Customer Screen

If you have a custom customer screen, you can initialize it by sending the URL link to Easypay. This allows your application to display your personalized interface for customer interactions.

//Initialize your custom Customer Screen by sending its URL to Easypay
const initCustomerScreen = () => {
    // Check if the updateCustomerDisplay handler is available
    if (window.updateCustomerDisplay) {
        const initRequest = {
            method: "initCustomerDisplayUrl",
            customerDisplayUrl: "https://your-customer-screen-url.com" // Replace with your customer screen URL
        }; 
        try {
            // Send the new order line request to Easypay's handler
            window.updateCustomerDisplay.postMessage(JSON.stringify(initRequest ));
             console.log("Initialized custom Customer Screen:", initRequest);
        } catch (error) {
            console.error("Failed to initialize Customer Screen:", error);
            // Optionally, implement retry logic or notify the user
        }
    } else {
        console.error("updateCustomerDisplay handler is not available.");
        // Optionally, fallback to WebSocket Integration or notify the user
    }
};

// Example usage:
initCustomerScreen();

Explanation:

  • Method: initCustomerDisplayUrl

  • Purpose: Sends the URL of your custom Customer Screen to Easypay to initialize it.

  • Parameters:

    • customerDisplayUrl: The URL of your custom Customer Screen.

Option 2: Using Easypay's Built-in Customer Screen

Easypay's built-in Customer Screen allows you to manage order lines dynamically. Below are the methods to add, update, remove, and synchronize order lines.

Adding a New Order Line

To add a new product to the current order displayed on the Customer Screen, utilize the newOrderLine method. This allows you to specify product details such as image, name, quantity, and price.

Explanation:

  • Method: newOrderLine

  • Purpose: Adds a new product to the current order displayed on the Customer Screen within the Easypay app.

  • Parameters:

    • product_image: URL of the product image.

    • id: Unique identifier for the product.

    • product_name: Name of the product.

    • quantity: Quantity of the product.

    • price: Price per unit of the product.

Updating an Existing Order Line

To update the details of an existing product in the current order, use the updateOrderLine method. This allows modifications to the product's quantity, price, or other attributes.

Explanation:

  • Method: updateOrderLine

  • Purpose: Updates the details of an existing product in the current order within the Easypay app.

  • Parameters:

    • product_image: URL of the product image.

    • id: Unique identifier for the product to be updated.

    • product_name: Name of the product.

    • quantity: New quantity of the product.

    • price: Price per unit of the product.

Removing an Order Line

To remove a specific product from the current order, utilize the removeOrderLine method by specifying the product's unique identifier.

Explanation:

  • Method: removeOrderLine

  • Purpose: Removes a specific product from the current order within the Easypay app.

  • Parameters:

    • id: Unique identifier of the product to be removed.

Creating a New Order (Clearing Order Lines)

To initiate a new order and clear all existing order lines, use the newOrder method. This is useful when starting a fresh transaction.

Explanation:

  • Method: newOrder

  • Purpose: Initializes a new order by clearing all existing order lines within the Easypay app.

  • Parameters: None.

Updating All Order Lines at Once

To efficiently update all order lines simultaneously, use the UpdateAllOrderlines method. This ensures synchronization between your POS system and the Customer Screen by sending the complete list of current order lines.

Explanation:

  • Method: UpdateAllOrderlines

  • Purpose: Sends the complete list of current order lines to the Customer Screen, ensuring synchronization between your POS system and the display.

  • Parameters:

    • data: An array of order line objects, each containing:

      • id: Unique identifier for the product.

      • product_name: Name of the product.

      • quantity: Quantity of the product.

      • unit_price: Price per unit of the product.

      • price: Total price for the product (unit_price × quantity).

      • product_image: URL of the product image.

Summary of In-App Integration Methods

Functionality
Method
Description

Add Order Line

newOrderLine

Adds a new product to the current order.

Update Order Line

updateOrderLine

Updates details of an existing product in the order.

Remove Order Line

removeOrderLine

Removes a specific product from the order.

Create New Order

newOrder

Clears all existing order lines to start a new order.

Update All Order Lines

UpdateAllOrderlines

Synchronizes all order lines at once with the screen.

Last updated