Skip to main content

Documentation Portal

ValidateStock (Global-e to Merchant)

Note

This API is part of Global-e's extensions and plug-ins. Merchants do not need to implement this API unless a custom integration is required.

The Merchant Cart Validation checks basic cart validity and validates the product’s stock availability.

If a product line cart item listed in order.Products does not have full stock availability for the specified quantity, this cart item is included in the AmendedProducts array with an indication of the quantity actually available. If all items are in stock, the AmendedProducts array is empty.

If required, the ValidateStock API is called when the shopper is in the Global‑e checkout. If the AmendedProducts array is not empty, the list of out-of-stock products is displayed to the shopper.

Note

In the GEM integration method, the GetCheckoutCartInfo API may be reused for stock validation purposes.

Method/URL

https://www.merchant-site-domain.com/checkout-validate-cart-stock-url
Parameters

Request

Name

Type

Description

Mandatory

order

Object Merchant.Order

Provides information related to the order.

Request

Name

Type

Description

Mandatory

Merchant.StockValidationResponse

Object Merchant.StockValidationResponse

Provides information related to validating that stock exists.

Objects for ValidateStock API
Examples

Request

{
    "GlobalECartToken": "1da35dc3-cbe6-4cd8-81d6-ce433466d715",
    "PreferredCultureCode": null,
    "AuthToken": "34sdfdg43erfg43234fwsedfsdf423",
    "SessionId": "12345",
    "DateCreated": "0001-01-01T00:00:00",
    "CurrencyName": null,
    "Parcels": null,
    "AllowMailsFromMerchant": false,
    "AllowDirectCommunicationFromMerchant": false,
    "ClearCart": false,
    "UserId": null,
    "CurrencyCode": "ILS",
    "Products": [{
            "Attributes": null,
            "Sku": "648340636",
            "Price": 157.7000,
            "PriceBeforeRoundingRate": null,
            "PriceBeforeGlobalEDiscount": null,
            "Quantity": 1,
            "VATRate": null,
            "CustomerVATRate": null,
            "InternationalPrice": 649.0000,
            "InternationalDiscountedPriceInMerchantCurrency": null,
            "CartItemId": "ci21000088",
            "ParentCartItemId": null,
            "CartItemOptionId": null,
            "HandlingCode": null,
            "GiftMessage": null,
            "RoundingRate": 0.0,
            "IsBackOrdered": false,
            "BackOrderDate": null,
            "DiscountedPrice": null,
            "InternationalDiscountedPrice": null,
            "ProductCodeSecondary": "MKC1120A~N~040~~NS",
            "Brand": null,
            "Categories": null,
            "ListPrice": 0.0,
            "InternationalListPrice": 0.0,
            "GenericHSCode": null,
            "DiscountedPriceForCustoms": 0.0,
            "InternationalDiscountedPriceForCustoms": 0.0,
            "IsGiftCard": false,
            "IsFixedPrice": true
        }
    ],
    "Customer": {
        "EmailAddress": null,
        "IsEndCustomerPrimary": false,
        "SendConfirmation": false
    },
    "PrimaryShipping": {
        "FirstName": "sdfsdf",
        "LastName": "sdfsdf",
        "MiddleName": null,
        "Salutation": null,
        "Company": null,
        "Address1": "asdasd+234",
        "Address2": "",
        "City": "asdasd",
        "StateCode": null,
        "StateOrProvince": null,
        "Zip": "1234567",
        "Email": "sdfsdf%40asdasd.com",
        "Phone1": "0000000000",
        "Phone2": null,
        "Fax": null,
        "CountryCode": "IL",
        "CountryCode3": null,
        "CountryName": null,
        "AddressBookId": null,
        "AddressBookName": null,
        "SaveAddress": false
    },
    "SecondaryShipping": {
        "FirstName": "GlobalE",
        "LastName": "GE-UK@EMA-Norsk",
        "MiddleName": null,
        "Salutation": null,
        "Company": "",
        "Address1": "Building 436, Argosy Road",
        "Address2": "East Midlands Airport",
        "City": "Derby",
        "StateCode": "NN",
        "StateOrProvince": null,
        "Zip": "DE74 2SA",
        "Email": "[email protected]",
        "Phone1": "01332 818723",
        "Phone2": null,
        "Fax": null,
        "CountryCode": "GB",
        "CountryCode3": "GBR",
        "CountryName": "United Kingdom",
        "AddressBookId": null,
        "AddressBookName": null,
        "SaveAddress": false
    },
    "ShippingMethodCode": "Express Courier (Air)",
    "Discounts": [],
    "Markups": [],
    "LoyaltyPointsSpent": null,
    "LoyaltyPointsEarned": null,
    "SameDayDispatch": false,
    "SameDayDispatchCost": 0.0,
    "DoNotChargeVAT": false,
    "CustomerComments": null,
    "IsFreeShipping": false,
    "FreeShippingCouponCode": null,
    "ShipToStoreCode": null,
    "RoundingRate": 0.0,
    "UrlParameters": "[{\"Key\":\"ClientCookie\",\"Value\":\"JSESSIONID=null\"},{\"Key\":\"userId\",\"Value\":\"1148993\"},{\"Key\":\"orderId\",\"Value\":\"w748807\"},{\"Key\":\"locale\",\"Value\":\"en_IL\"}]",
    "OriginalMerchantTotalProductsDiscountedPrice": 0.0,
    "LoyaltyCode": null,
    "OTVoucherCode": null,
    "OTVoucherAmount": null,
    "OTVoucherCurrencyCode": null,
    "IsSplitOrder": false,
    "PrePayOffered": false,
    "InitialCheckoutCultureCode": null,
    "CultureCode": null,
    "HubId": 0,
    "IsReplacementOrder": false,
    "OriginalOrder": null,
    "ReservationRequestId": null,
    "IsSuppressPersonalInformation": false,
    "TotalDutiesAndTaxesPrice": 0.0,
    "USSalesTax": 0.0,
    "CCFPrice": 0.0,
    "PaymentDetails": null,
    "PrimaryBilling": {
        "FirstName": null,
        "LastName": null,
        "MiddleName": null,
        "Salutation": null,
        "Company": null,
        "Address1": null,
        "Address2": null,
        "City": null,
        "StateCode": null,
        "StateOrProvince": null,
        "Zip": null,
        "Email": null,
        "Phone1": null,
        "Phone2": null,
        "Fax": null,
        "CountryCode": null,
        "CountryCode3": null,
        "CountryName": null,
        "AddressBookId": null,
        "AddressBookName": null,
        "SaveAddress": false
    },
    "SecondaryBilling": {
        "FirstName": null,
        "LastName": null,
        "MiddleName": null,
        "Salutation": null,
        "Company": null,
        "Address1": null,
        "Address2": null,
        "City": null,
        "StateCode": null,
        "StateOrProvince": null,
        "Zip": null,
        "Email": null,
        "Phone1": null,
        "Phone2": null,
        "Fax": null,
        "CountryCode": null,
        "CountryCode3": null,
        "CountryName": null,
        "AddressBookId": null,
        "AddressBookName": null,
        "SaveAddress": false
    },
    "OrderId": null,
    "StatusCode": null,
    "MerchantGUID": "7f132fc6-bdbc-420e-a2ce-fd35ab5c06d0",
    "CartId": "_2S0DVucAbjgfHAR-SUmRshWaS3pB5F9Bk7OfgWBR9ujllKrTw5H!17426857!1596453641116",
    "MerchantOrderId": null,
    "PriceCoefficientRate": 0.0,
    "CartHash": "94210A58BAC3B3AB292DE94382910C87",
    "WebStoreCode": "en_IL",
    "WebStoreInstanceCode": "GlobalEDefaultStoreInstance",
    "DiscountedShippingPrice": 0.0,
    "InternationalDetails": null,
    "GiftCards": null
}

Responses

Example of generic error:

Error code 3 is expected. An appropriate error message is shown to the customer and a new clean cart is generated.

{
    "AmendedProducts": [],
    "Error": "3",
    "StackTrace": " at CallSite.Target(Closure , CallSite , Object )\r\n at GlobalE.GEM.BL.GEMProviders.BaseProviders.BaseGEMProvider.ParseReservationInfo(Object reservationInfo) in C:\\jenkins\\workspace\\GEPI\\787e4b5b9a7709ca06b57fcfbeb2bdb2\\GlobalE.GEM.BL\\GEMProviders\\BaseProviders\\BaseGEMProvider.cs:line 844",
    "ReservationRequestId": null
}

Example of invalid email error:

Error code 2 is expected. An appropriate error message is shown to the customer and a new clean cart is generated.

{
    "AmendedProducts": [],
    "Error": "2",
    "StackTrace": null,
    "ReservationRequestId": null
}

Example of invalid cart content error:

Error code 1 is expected. One of the cart fields is invalid. An appropriate error message is shown to the customer and a new clean cart is generated.

{
    "AmendedProducts": [],
    "Error": "1",
    "StackTrace": null,
    "ReservationRequestId": null
}

If all products are in stock:

{
    "AmendedProducts": [],
    "ReservationRequestId": null,
    "Error": null
}

If some products are out of stock:

{
    "AmendedProducts": [{
            "CartItemID": "11007",
            "QuantityInStock": 1
        }
    ],
    "ReservationRequestId": null
}