POST

check_cart

Every time a customer changes the contents of the cart in the Mobile Website or apps this action will be requested to validate the contents. This is currently used to validate coupons, check the stock of the items and return shipping service providers of the shopping cart system. Future applications include a change of products for the cart contents.

Query parameters

action
string

Requested method

required
default : check_cart
shop_number
string

Your shop number.

required
trace_id
string

Unique request trace ID. Example: “sma-9412”

required
language
string

Request language. The customer’s selected language in the app. Example: "DE-DE:, “US-EN”

required
cart
object
required
internal_cart_info
string

The exact “internal_cart_info” that was returned on the last “check_cart” request for this particular cart.

1 validation
tracking_get_parameters
array[object]
customer_number
string

The customer number in the Shopgate system.

1 validation
external_customer_number
string

Customer number in the shopping cart system (if registered via Shopgate Connect).

1 validation
external_customer_id
string

The customer’s database ID in the shopping cart system (if registered via Shopgate Connect).

1 validation
external_customer_group_id
string

The ID of the customer group in the shopping cart system.

1 validation
external_customer_group
string

Name of customer group.

1 validation
mail
string

The customer’s mail address.

1 validation
custom_fields
array[object]
client
array[object]
amount_shipping
number

Shipping amount

1 validation
shipping_group
string

Shpping Service ID

1 validation
shipping_type
string

API Version, “MANUAL” if no API was used.

1 validation
shipping_infos
array[object]
payment_group
string

Payment group chosen by the customer.

1 validation
payment_method
string

Payment method chosen by the customer.

1 validation
external_coupons
array[object]
shopgate_coupons
array[object]
invoice_address
object
delivery_address
object
items
array[object]

Response

application/json
array[object]
error
integer

False means no error.

required
error_text
string

Error text; null means no error.

required
shopgate_library_version
string

Shopgate Library version.

required
plugin_version
string

Plugin version.

required
trace_id
string

Request trace-ID, needed as reference for contact

required
internal_cart_info
string

Information regarding this particular cart, that you want to have passed on the next “check_cart” request.

1 validation + required
currency
string

The currency of the cart.

1 validation
customer
object
external_coupons
array[object]
required
shipping_methods
array[object]
items
array[object]
required
payment_methods
array[object]

Error Codes

Code Description
2 cannot open/create logfile(s)
10 invalid value in configuration
11 error reading or writing configuration
20 no action specified
21 unknown action requested
22 disabled action requested
23 wrong response format
83 database error
100 no connection to server
101 Unknown action
102 error code received from merchant API
120 authentication failed
200 the coupon is not valid
201 the coupon code is not valid
202 products for coupon are not valid
203 delivery address for coupon is not valid
204 user is not valid for coupon
205 too many coupons in cart
300 product is not in stock
301 product not found
302 less stock available than requested
303 product input validation failed: text too long
304 requested quantity is lower than required minimum quantity
305 requested quantity is higher than allowed maximum quantity
306 products can not be ordered together
307 product not allowed in cart constellation
999 Unknown error

Example

{
  "error": 0,
  "error_text": null,
  "trace_id": null,
  "shopgate_library_version": "2.4.14",
  "plugin_version": "2.4.29",
  "currency": "USD",
  "internal_cart_info": "{\"cart_id\":82,\"coupons\":[{\"code\":\"spring30\",\"status\":\"removed\"},{\"code\":\"shipfree\",\"status\":\"applied\"}]}",
  "customer": {
    "customer_tax_class_key": "Retail Customer",
    "customer_groups": [
      {
        "id": "1"
      },
      {
        "id": "13"
      }
    ]
  },
  "shipping_methods": [
    {
      "id": "flatrate_flatrate",
      "title": "Fixed",
      "shipping_group": "flatrate",
      "description": "",
      "sort_order": null,
      "amount": 50,
      "amount_with_tax": 50,
      "tax_class": 0,
      "tax_percent": "0.00",
      "internal_shipping_info": null
    }
  ],
  "items": [
    {
      "item_number": "1",
      "is_buyable": 1,
      "qty_buyable": 5,
      "unit_amount": 750,
      "unit_amount_with_tax": 750,
      "error": null,
      "error_text": null,
      "options": [],
      "inputs": [],
      "attributes": []
    },
    {
      "item_number": "126-127",
      "is_buyable": 1,
      "qty_buyable": 5,
      "unit_amount": 18.75,
      "unit_amount_with_tax": 18.75,
      "error": null,
      "error_text": null,
      "options": [],
      "inputs": [],
      "attributes": []
    },
    {
      "item_number": "1",
      "is_buyable": 0,
      "qty_buyable": 0,
      "unit_amount": 0,
      "unit_amount_with_tax": 0,
      "error": 300,
      "error_text": "product is not in stock",
      "options": [],
      "inputs": [],
      "attributes": []
    }
  ],
  "external_coupons": [
    {
      "is_valid": false,
      "not_valid_message": "Coupon code \"shopgate\n\" is not valid.",
      "code": "shopgate\n",
      "name": null,
      "description": null,
      "amount": null,
      "amount_net": null,
      "amount_gross": null,
      "tax_type": "auto",
      "currency": null,
      "is_free_shipping": null,
      "internal_info": null
    }
  ],
  "payment_methods": [
    {
      "id": "cod"
    },
    {
      "id": "paypal"
    }
  ]
}