Setup your checkout

Introduction:

To ensure seamless integration between Modemagic and other external platforms, we require certain functionalities to be exposed and supported by the platform to process orders. This document outlines the requirements that need to be met to facilitate a smooth integration process.

System Requirements:

1. Validation of Variant and Price:

To guarantee the integrity of cart items and to avoid potential discrepancies or tampering, we require a dedicated API for validation:

Endpoint:

  • A dedicated API endpoint that takes in product variant IDs and returns the current, valid price for each variant.

Input:

  • Variant ID(s)

Expected Output:

  • Current Price(s) for the respective Variant ID(s)

2. Application of Custom Discounts:

Our app provides custom discounts which can either be a fixed amount or a percentage. While creating checkouts, we should be able to specify custom discounts

"discount": {
		"value": 10,
		"type": "percentage"
	}

3. Attribution Information:

For tracking and analytics purposes, our system requires attribution data to be appended to each cart item.

The checkout API should support attaching properties with each item. Properties should be an array so as to attach multiple properties

"properties":[
               {
                  "name":"__mmWidget",
                  "value":"{\"widget_id\": \"2b99b63e-03b7-4c13-af4a-e50cdb5926ee\", \"storyboard_id\": \"\", \"template_id\": \"\"}"
               }
            ]

Use Case:

Different items in the cart may be added via different widgets. As a result, it is essential to store attribution data at an individual item level, so that analytics and tracking can be performed accurately.

Integration with External Checkout

If any external checkout is used, we will have to integrate with that checkout system

There are two main ways of integrating with external checkouts:

  1. Redirect URL Checkout: In this method, from our Backend, we will send data to external checkout, which would provide a checkout URL. The Frontend (FE) will use this URL to navigate the user to the checkout page of the provider.
  2. Modal Checkout: In this approach, the Backend sends a payload to the FE. The FE then forwards this payload to the checkout provider's endpoint, which subsequently handles the validation and other required operations. The checkout happens on same page using a modal.