Documentation

Retail Integration

This page describes the existing retail integrations you can use on your retail site.

Prerequisites

You must have a retail site configured with MidwayPlus. Your MidwayPlus retail site includes a domain name which must be used to interact with your account. In the below examples, we'll use test.midwayplus.com

Initialization

Include the MidwayPlus retail API in your website. Make sure to include the id="mwp-script" on the script tag.

<script id="mwp-script" src="https://test.midwayplus.com/js/mwp.js"></script>

Product Data

The primary function to get product data is via mwpSearchProducts(search, year, make, model, submodel, group, page, pageSize). mwpSearchProducts returns a promise that contains product search result information. The response has aggregate data, a list of matching products, and the count of the total results. See the example response below.
Note: For a product to show up in your results, it must have a Retail Price set.

{
    "totalResults": 2,
    "aggregate1": [
        {
            "count": 1,
            "name": "Custom Aggregate 1"
        },
        {
            "count": 1,
            "name": "Custom Aggregate 2"
        }
    ],
    "aggregate2": [
        {
            "count": 1,
            "name": "Custom Aggregate A"
        },
        {
            "count": 1,
            "name": "Custom Aggregate B"
        }
    ],
    "attributes": [
        {
            "name": "Size",
            "buckets": [
                {
                    "name": "Medium",
                    "count": 1
                }
                {
                    "name": "Large",
                    "count": 1
                }
            ]
        }
    ],
    "categories": [
        {
            "count": 1,
            "name": "Category One"
        },
        {
            "count": 1,
            "name": "Category Two"
        }
    ],
    "products": [
        {
            "allowBackorder": true,
            "buildLeadTimeDays": null,
            "id": 1178,
            "images": [
                "https://midwayblob1.blob.core.windows.net/midway/fa87374a-3760-46bc-a540-3ef182f583a3?sv=2020-08-04&st=2022-03-22T12%3A39%3A36Z&se=7022-03-22T12%3A41%3A36Z&sr=b&sp=r&sig=0003IUavas8R8GO%2B%2BsRF6B7PKQvN4w343Q6naMz9pzg%3D"
            ],
            "inStock": 32,
            "longDescription": "A long text description of this product",
            "minimumOrderQty": 1,
            "partNumber": "SKU123",
            "programDiscount": 0,
            "programId": 0,
            "retailSellingPrice": 1070.09,
            "shipsGroundOnly": false,
            "shipsLTLOnly": false,
            "shortDescription": "Short description",
            "supplierCategory": "Category One",
            "supplierName": "Widget Factory",
            "title": "The second greatest widget in existence!",
            "vehicleApplications": null
        },
        {
            "allowBackorder": true,
            "buildLeadTimeDays": null,
            "id": 799,
            "images": [
                "https://midwayblob1.blob.core.windows.net/midway/fa87374a-3760-46bc-a540-3ef182f583a3?sv=2020-08-04&st=2022-03-22T12%3A39%3A36Z&se=7022-03-22T12%3A41%3A36Z&sr=b&sp=r&sig=0003IUavas8R8GO%2B%2BsRF6B7PKQvN4w343Q6naMz9pzg%3D",
                "https://midwayblob1.blob.core.windows.net/midway/dd06989a-4fd2-4e7e-8e93-4cc8f47fd4a8?sv=2020-08-04&st=2022-02-03T13%3A44%3A43Z&se=7022-02-03T13%3A46%3A43Z&sr=b&sp=r&sig=QTHsmiZST0TagfSBAyy1ASgXQ2onaxXMYqanfM7EqLc%3D"
            ],
            "inStock": 6,
            "longDescription": "A long text description of this product",
            "minimumOrderQty": 1,
            "partNumber": "SKU124",
            "programDiscount": 0,
            "programId": 0,
            "retailSellingPrice": 298.18,
            "shipsGroundOnly": false,
            "shipsLTLOnly": false,
            "shortDescription": "Short Description",
            "supplierCategory": "Category Two",
            "supplierName": "Widget Factory",
            "title": null,
            "vehicleApplications": [
                {
                    "make": "Toyota",
                    "model": "Corona",
                    "submodel": "Base",
                    "year": 1975
                },
                {
                    "make": "Toyota",
                    "model": "Corona",
                    "submodel": "DLX",
                    "year": 1976
                }
            ]
        }
    ]
}

After doing an initial search of products (or if you don't need aggregate information), you can further filter results with mwpFilterProducts(search, year, make, model, submodel, groups, aggregate1, aggregate2, brands, inStockOnly, supplierCategories, attributes, page, pageSize) using the original search parameters combined with additional filter inputs. The returned promise is the same as mwpSearchProducts without aggregate1, aggregate2, attributes, and categories

You can also load an individual product's data using mwpGetProduct(productIdOrSku). To match the MidwayPlus PartNumber, productIdOrSku must be a string. To match the internal MidwayPlus product ID, productIdOrSku should be a number. An example response is shown below:

{
    "product": {
        "attributes": [
            {
                "key": "Size",
                "value": "Medium"
            }
        ],
        "height": 5.5,
        "htmlLongDescription": null,
        "imgUrls": [
            "https://midwayblob1.blob.core.windows.net/midway/796cb031-4ab9-4e08-a081-d3a711eb2e44?sv=2020-08-04&st=2022-02-03T13%3A46%3A22Z&se=7022-02-03T13%3A48%3A22Z&sr=b&sp=r&sig=RUgCSRjiEoRxQfIqEuydHyrE7HQj%2FK%2F90pleuaI7%2FlY%3D",
            "https://midwayblob1.blob.core.windows.net/midway/3cc6fc35-2840-4f64-8d4a-c8c58626e0b1?sv=2020-08-04&st=2022-03-22T12%3A40%3A33Z&se=7022-03-22T12%3A42%3A33Z&sr=b&sp=r&sig=al1brgvmsZ%2FKZKsphAJLRpDhTawKcAzwrGq7YH3zyos%3D"
        ],
        "length": 16,
        "longDescription": "A long description",
        "outOfStockNotAvailable": false,
        "partNumber": "SKU125",
        "priceEach": 2062.06,
        "productId": 1109,
        "shortDescription": "Short description",
        "title": "Hyper Twin Series Cerametallic Clutch and Flywheel Kit",
        "vehicleApplications": [
            {
                "year": 1992,
                "make": "Toyota",
                "model": "MR2",
                "submodel": "Turbo"
            }
        ],
        "weight": 33.4,
        "width": 16.25
    }
}
            

Vehicle Year, Make, and Model information

mwpGetMakes(), mwpGetModels(make), mwpGetSubmodels(make, model), and mwpGetYears(make, model, submodel) can be used to get available vehicles. Each function returns a promise with an array of strings.

["Acura", "Alfa Romeo", "Audi"]

Interacting with the Cart

The following functions can be used to manipulate the cart: mwpAddToCart(productId, quantity), mwpDeleteFromCart(lineId), mwpDeleteProductFromCart(productId)

You can retrieve the customer's cart using mwpGetCart() which returns a promise that has an array of products in the cart. An example response with one item in the cart is shown below.

[
    {
        "backorder": false,
        "basePriceEach": 100.00,
        "freeFreight": false,
        "id": 112646,
        "imgUrl": "https://midwayblob1.blob.core.windows.net/midway/540e9daf-d6fd-4b8e-b4d4-75a4e29a8c96?sv=2020-08-04&st=2022-02-03T13%3A46%3A41Z&se=7022-02-03T13%3A48%3A41Z&sr=b&sp=r&sig=RWRi8beqxjjAEL0UJ5OgIevCC6dQs2ZWnU%2BbQTnH%2Bmg%3D",
        "productId": 1178,
        "quantity": 1,
        "title": "Product Title"
    }
]

Starting Checkout

If MidwayPlus is managing your cart, and you're using the functions described above to interact with the cart, you need only to redirect your user to the checkout page, test.midwayplus.com/Checkout

If you are managing the users shopping cart outside of MidwayPlus, see the checkout integration page for integration information.