POST /v1/order_previews

Returns an order preview, which in most cases is just a reiteration of the input line items along with a total shipping cost estimate. If an item is no longer available, make sure to return "available": false for that line item, but return a shipping estimate as if that item was not included in the original line items at all (or, as if its quantity was set to 0).

Note: Merchbar offers international shipping with a number of our partners. If you do not support international shipping, let us know, and also make sure to return an error response here if a country other than "US" is specified.

Example Request Body:

{
    "address": {
        "first_name": "Loyal",
        "last_name": "Customer",
        "line1": "123 Main St.",
        "line2": null,
        "city": "San Francisco",
        "state": "CA",
        "postal_code": "94102",
        "country": "US"
    },
    "line_items": [
        {
            "id": "SKU456",
            "quantity": 2
        },
        {
            "id": "SKU123",
            "variant_id": "SKU1232X",
            "quantity": 1
        }
    ]
}

Example Response:

{
    "data": {
        "address": {
            "first_name": "Loyal",
            "last_name": "Customer",
            "line1": "123 Main St.",
            "line2": null,
            "city": "San Francisco",
            "state": "CA",
            "postal_code": "94102",
            "country": "US"
        },
        "line_items": [
            {
                "id": "SKU456",
                "quantity": 2,
                "available": true
            },
            {
                "id": "SKU123",
                "variant_id": "SKU1232X",
                "quantity": 1,
                "available": true
            }
        ],
        "shipping_options": [
            {
                "id": "USPSPRI",
                "title": "USPS Priority Mail",
                "ship_date": "2016-08-01",
                "ship_time": "2-3 business days",
                "price": "19.98",
                "currency": "USD"
            },
            {
                "id": "USPSFC",
                "title": "USPS First-Class Mail",
                "ship_date": "2016-08-01",
                "ship_time": "5-6 business days",
                "price": "6.98",
                "currency": "USD"
            },
            {
                "id": "USPSEXP",
                "title": "USPS Priority Mail Express",
                "ship_date": "2016-08-01",
                "ship_time": "Overnight",
                "price": "36.22",
                "currency": "USD"
            }
        ]
    }
}
Was this article helpful?
0 out of 0 found this helpful