Open2b versione 7.5

cart

Returns and eventually updates a cart. It creates a new cart if token is missing or is null.

If a customer key is given, the cart is updated and returned vary according to custormer's group, otherwise according to the default customer group.

To create a new cart, don't pass token or pass token equals to null. The new cart token is returned in the response.

Request (not updates the cart)

HTTP POST
/api/v10/storefront.cart
{
  "token" : "RtRi8JWsxK…TMwTA1UJtg", // token (can be null) - string(32)
  "language" : "en", // language (ISO code) - string(2)
  "fields" : [ "token", "isQuote", … ], // fields to return
  "estimate" : false // indicates if the taxes must be estimated - bool
}

Request (updates the cart)

HTTP POST
/api/v10/storefront.cart
{
  "token" : "RtRi8JWsxK…TMwTA1UJtg", // token (can be null) - string(32)
  "language" : "en", // language (ISO code) - string(2)
  "fields" : [ "token", "isQuote", … ], // fields to return
  "update" : { // cart fields to update (can be null)
    "expirationTime" : "2021-03-12 14:22:06", // expiration time - datetime
    "coupon" : "PROMO2020", // coupon code (can be null) - string(1…32)
    "items" : [ { // items to add. Previous items will be removed
      "sku" : "A927TP", // SKU (required) - string(1…40)
      "quantity" : 2.00, // quantity (required) - decimal[8,2](0…)
      "requests" : "…" // customer requests - string(0…255)
    }, … ],
    "itemsToAdd" : [ { // items to add to the previous items
      "sku" : "A927TP", // SKU (required) - string(1…40)
      "quantity" : 2.00, // quantity (required) - decimal[8,2](0…)
      "requests" : "…" // customer requests - string(0…255)
    }, … ],
    "itemsToRemove" : [ "A927TP", … ], // items (SKU) to remove - string(1…40)
    "shippingMethod" : 14, // shipping method (id) (can be null) - int(1…)
    "paymentMethod" : 3, // payment method (id) (can be null) - int(1…)
    "invoiceRecipient" : "AB7TR6K", // invoice recipient -- string(0…256)
    "billingAddress" : { // billing address (can be null)
      "firstName" : "Sherlock", // first name - string(1…25)
      "lastName" : "Holmes", // last name - string(1…25)
      "personalCode" : "SH239IBA", // personal code - string(0…20)
      "companyName" : "Investigations Inc", // company name - string(0…100)
      "companyCode" : "INV8403MC1", // company code number - string(0…20)
      "companyCode2" : "7J BA3 006", // second company code number - string(0…20)
      "street1" : "221b Baker Street", // street, first row - string(1…60)
      "street2" : "", // street, second row - string(0…60)
      "city" : "London", // city - string(1…25)
      "postalCode" : "NW1 6XE", // postal code - string(1…20)
      "stateProv" : "LND", // state, province or county - string(0…3)
      "country" : "GB", // country (ISO code) - string(2)
      "phoneNumber" : "+44+207 2243688", // phone number - string(0…15)
      "mobileNumber" : "", // mobile number - string(0…15)
      "faxNumber" : "", // fax number - string(0…15)
      "email" : "holmes@inv-london.com" // email address - string(3…120)
    },
    "shippingAddress" : { // shipping address (can be null)
      "name" : "John", // recipient name - string(1…100)
      "street1" : "221b Baker Street", // street, first row - string(1…60)
      "street2" : "", // street, second row - string(0…60)
      "city" : "London", // city - string(1…25)
      "postalCode" : "NW1 6XE", // postal code - string(1…20)
      "stateProv" : "LND", // province, state or county - string(0…3)
      "country" : "GB" // country (ISO code) - string(2)
    },
    "requests" : "…", // requests - string(0…65535)
    "privacyConsents" : [ 1, 23, … ] // privacy processings which the customer is giving consent to - int(1…)
  },
  "estimate" : false // indicates if the taxes must be estimated - bool
}

Response

{
  "status" : "ok",
  "cart" : {
    "token" : "RtRi8JWsxK…TMwTA1UJtg", // token - string(32)
    "isQuote" : false, // indicates if it is a quote - bool
    "creationTime" : "2020-09-12 16:48:22", // last access time - datetime
    "expirationTime" : "2020-09-13 18:37:06", // expiration time - datetime
    "items" : [ { // items
      "sku" : "A927TP", // SKU - string(1…40)
      "toQuote" : false, // indicates if it have to be quoted - bool
      "product" : 281, // product (ID) - int(1…)
      "departments" : [ 63, 49, 70, 90, 101 ], // departments (ID) - int(1…)
      "producer" : 290, // producer (ID) (can be null) - int(1…)
      "quantity" : 3.00, // quantity - decimal[8,2](0…)
      "adjustment" : { // quantity adjustment
        "original" : 5.00, // original quantity - decimal[8,2](0…)
        "reason" : "MaxQuantity" // adjustment reason, can be "MinQuantity", "MaxQuantity" or "StepQuantity" - string
      },
      "stock" : 3.00, // stock - decimal[8,2](0..)
      "unitOfMeasure" : { // unit of measure
        "name" : "Kg", // name - string(0…32)
        "decimalPlaces" : 2 // decimal places - int(0…2)
      },
      "listPrice" : { // list price (can be null)
        "net": 56.330, // net price - decimal[10,3](0…)
        "gross": 68.723 // gross price - decimal[10,3](0…)
      },
      "rows" : [ { // rows
        "quantity" : 3.00, // quantity - decimal[8,2](0..)
        "salePrice" : { // sale price (can be null)
          "net": 54.120, // net price - decimal[10,3](0…)
          "gross": 66.026 // gross price - decimal[10,3](0…)
        },
        "totalPrice" : { // sale price (can be null)
          "net": 162.36, // net price - decimal[10,3](0…)
          "gross": 198.08 // gross price - decimal[10,3](0…)
        },
        "promotions" : [ { // promotions on quantity applied to the row
          "id": 12, // promotion identifier - int(1…)
          "name": "Buy 3 pay 2" // promotion name - string(0..60)
        }, … ]
      }, … ],
      "salePrices" : [ { // sale price for each tier (can be null)
        "from" : 1.00, // from quantity - decimal[11,2](0…)
        "to" : 10.00, // to quantity (can be null) - decimal[11,2](0…)
        "price" : { // sale price
          "net": 54.120, // net price - decimal[10,3](0…)
          "gross": 66.026 // gross price - decimal[10,3](0…)
        }
      }, … ],
      "taxRate" : 19.00, // tax rate - decimal[4,2](0…)
      "weight" : 0.450, // weight - decimal[8,3](0…)
      "barcode" : "09781555553333", // barcode (EAN13, UPC o ISBN13) - string(12…14)
      "releaseDate" : null, // date when it will be available if it is pre-ordinable - date
      "reorderDays" : 5, // days to wait before it returns available - int(0…255)
      "thumbnailImage" : { // thumbnail image (can be null)
        "url" : "https://…", // URL - string(10…)
        "url2x" : "https://…", // double resolution URL (can be null) - string(10…)
        "width" : 40, // width in pixel - int(30…50)
        "height" : 40 // height in pixel - int(30…50)
      },
      "smallImage" : { // small image (can be null)
        "url" : "https://…", // URL - string(10…)
        "url2x" : "https://…", // double resolution URL (can be null) - string(10…)
        "width" : 70, // width in pixel - int(50…250)
        "height" : 70 // height in pixel - int(50…250)
      },
      "mediumImage" : { // medium image (can be null)
        "url" : "https://…", // URL - string(10…)
        "url2x" : "https://…", // double resolution URL (can be null) - string(10…)
        "width" : 150, // width in pixel - int(50…250)
        "height" : 150 // height in pixel - int(50…250)
      },
      "name" : "Shirt", // name - string(0…120)
      "description" : "…", // description - string(0…255)
      "canonicalURL" : "https://www.site.com/shirt", // canonical URL - string(10…)
      "variants" : [ { // variants, up to 3
        "id" : 3, // identifier - int(1…)
        "name" : "Color", // name - string(0…60)
        "showName" : true // indicates if the name should be displayed - bool
      } … ],
      "options" : [ { // options, up to 3
        "id" : 3, // identifier - int(1…)
        "name" : "Red", // name - string(0…60)
        "icon" : { // icon (can be null)
          "color" : "CC0066", // color in hexadecimal format (can be null) - string(6)
          "image" : { // image (can be null)
            "url" : "https://...", // URL - string(10…)
            "width" : 16, // width in pixel - int(1…100)
            "height" : 16 // height in pixel - int(1…100)
          }
        }
      } … ],
      "infoForRequests" : "…", // information for customer requests - string(0…255)
      "requests" : "…" // customer requests - string(0…255)
    }, … ],
    "coupon" : "PROMO2020", // coupon code - string(0…32)
    "prediscountSubtotal" : { // prediscount subtotal
      "net": 162.36, // net - decimal[10,2](0…)
      "gross": 198.08 // gross - decimal[10,2](0…)
    },
    "discounts" [ { // discounts, up to 5
      "amount" : { // amount (can be null)
        "net" : 20.000, // net - decimal[8,3](0…)
        "gross" : 24.400 // gross - decimal[8,3](0…)
      },
      "percent" : 20.000 // percent (can be null) - decimal[5,3](0…)
    }, … ],
    "subtotal" : { // subtotal
      "net": 162.36, // net - decimal[10,2](0…)
      "gross": 198.08 // gross - decimal[10,2](0…)
    },
    "minSubtotal" : 100.00, // minimum subtotal allowed (can be null)
    "maxSubtotal" : 2000.00, // maximum subtotal allowed (can be null)
    "shippingMethod" : { // shipping method (can be null)
      "id" : 14, // identifier - int(1…)
      "name" : "FedEx", // name - string(0…80)
      "cost" : {
        "net": 8.57, // net - decimal[10,2](0…)
        "gross": 10.4554 // gross - decimal[10,2](0…)
      },
      "isDomestic" : false, // indicates if it is domestic - bool
      "zones" : [ "GB", "IT", "FR" ] // countries, provinces, states or counties which it is applied - string
    },
    "shippingMethods" : [ { // shipping methods available
      "id" : 14, // identifier - int(1…)
      "name" : "FedEx", // name - string(0…80)
      "cost" : {
        "net": 8.57, // net - decimal[10,2](0…)
        "gross": 10.4554 // gross - decimal[10,2](0…)
      },
      "isDomestic" : false, // indicates if it is domestic - bool
      "zones" : [ "GB", "IT", "FR" ] // countries, provinces, states or counties which it is applied - string
    }, … ],
    "paymentMethod" : { // payment method (can be null)
      "id" : 3, // identifier - int(1…)
      "name" : "Credit card", // name - string(0…80)
      "description" : "Visa and Mastercard", // description - string(0…255)
      "cost" : {
        "net": 3.89, // net - decimal[10,2](0…)
        "gross": 4.7458 // gross - decimal[10,2](0…)
      }
    },
    "paymentMethods" : [ { // payment methods available
      "id" : 3, // identifier - int(1…)
      "name" : "Credit card", // name - string(0…80)
      "description" : "Visa and Mastercard", // description - string(0…255)
      "cost" : {
        "net": 3.89, // net - decimal[10,2](0…)
        "gross": 4.7458 // gross - decimal[10,2](0…)
      }
    }, … ],
    "taxAmount" : 31.25, // tax amount - decimal[10,2](0…)
    "total" : { // total
      "net": 89.23, // net - decimal[10,2](0…)
      "gross": 108.86 // gross - decimal[10,2](0…)
    },
    "quantity" : 7.00, // quantity - decimal[10,2](0..)
    "weight" : 1.350, // weight - decimal[8,3](0..)
    "invoiceRecipient" : "AB7TR6K", // invoice recipient -- string(0…256)
    "billingAddress"  : { // billing address (can be null)
      "firstName" : "Sherlock", // first name - string(1…25)
      "lastName" : "Holmes", // last name - string(1…25)
      "personalCode" : "SH239IBA", // personal code - string(0…20)
      "companyName" : "Investigations Inc", // company name - string(0…100)
      "companyCode" : "INV8403MC1", // company code number - string(0…20)
      "companyCode2" : "7J BA3 006", // second company code number - string(0…20)
      "street1" : "221b Baker Street", // street, first row - string(1…60)
      "street2" : "", // street, second row - string(0…60)
      "city" : "London", // city - string(1…25)
      "postalCode" : "NW1 6XE", // postal code - string(1…20)
      "stateProv" : "LND", // state, province or county - string(0…3)
      "country" : "GB", // country (ISO code) - string(2)
      "phoneNumber" : "+44+207 2243688", // phone number - string(0…15)
      "mobileNumber" : "", // mobile number - string(0…15)
      "faxNumber" : "", // fax number - string(0…15)
      "email" : "holmes@inv-london.com" // email address - string(3…120)
    },
    "shippingAddress" : { // shipping address (can be null)
      "name" : "John", // recipient name - string(1…100)
      "street1" : "221b Baker Street", // street, first row - string(1…60)
      "street2" : "", // street, second row - string(0…60)
      "city" : "London", // city - string(1…25)
      "postalCode" : "NW1 6XE", // postal code - string(1…20)
      "stateProv" : "LND", // province, state or county - string(0…3)
      "country" : "GB" // country (ISO code) - string(2)
    },
    "shippingCountries" : [ "GB", "IT", … ], // countries (ISO Code) to which it can be shipped - string(2)
    "shippingStateProvs" : [ "LND", … ], // provinces, states or counties (ISO Code) to which it can be shipped - string(1…3)
    "requests" : "…", // requests - string(0…65535)
    "privacyConsents" : [ {
      "processing" : 3, // identifier - int(1…255)
      "processingTitle" : "Terms and Conditions", // title - string(0…60)
      "processingDescription" : "", // description - string(0…1000)
      "detailsPage" : "", // details page (ID) (can be null) - int(1…)
      "lawfulBase" : "Consent", // lawful base, can be "Consent", "Contract", "LegalObligation", "LegitimateInterest" or "Other" - string
      "isConsentRequired" : "true", // indicates if the consent for this processing is required - bool
      "hasBeenGiven" : "true", // indicates if the consent has been given - bool
    }, … ] // privacy consents that has been or can be given
  }
}

Errors

Field Type Description
items Malformed Item '<sku>' is duplicated
paymentMethod NotFound Payment method <paymentMethod> does not exist
privacyConsents InvalidValue Consent to processing <processing> is required
shippingMethod NotFound Shipping method <shippingMethod> does not exist