The cart
is the main object processed by Ollie Shop Checkout API.
It stores a lot of contextual information about the order which is important to the proper processing of the order:
order items, client's personal data, delivery address, freight information, etc.
Using Ollie Shop APIs this information can be accessed, processed, and even changed on certain occasions.
The Checkout API is one of the main interfaces interacting with the cart
object. Most of its operations will return the cart
or part of it.
The object's basic structure is:
{
"data": {
"id": "{{cartId}}",
"items": [],
"totalizer": {
"total": 0
},
"customer": null,
"shipping": null,
"delivery": null,
"culture": {
"currency": "USD",
"country": "USA",
"locale": "en-US"
},
"payment": {
"selected": [],
"options": []
},
"extensions": {}
},
"_metadata": {
"version": "02c047a8-f109-4998-a258-0ef40d258ca3",
"functions": []
}
}
The cart
is composed of two fundamental objects:
data
and _metadata
The data
object is the actual cart information, while _metadata
is where you'll find information regarding the functions that are interacting with your cart. Click here to learn more about Functions.
Cart
Sections
Cart
SectionsItems
It's an array containing an object for every item in the buyer's cart.
[
{
"id": "2",
"name": "adidas Women's Microdot Polo - Night Indigo S",
"href": "/adidas-womens-microdot-polo-night-indigo/p",
"price": 67670,
"quantity": 1,
"image": "https://olliepartnerus.vteximg.com.br/arquivos/ids/155402-1000-1000/adidas-womens-microdot-polo-night-indigo.jpg?v=638469804501800000",
"lineId": "2e757f20f9ff4638b1f2892c6350e662",
"available": true,
"deliveryMethods": [],
"attributes": [
{
"key": "sellerId",
"value": "1"
}
]
}
]
Field | Type | Description |
---|---|---|
id | string | id of the product |
name | string | name of the product |
href | string | link of the product |
price | number | price without discounts |
quantity | number | quantity of this product in your cart |
image | string | link to the image of this product |
lineId | string | unique id used to identify this product inside the items array |
available | boolean | If the product is available to purchase or not |
deliveryMethods | array of objects | array of objects with the delivery options available for this product |
attributes | array of objects |
attributes
Field | Type | Description |
---|---|---|
key | string | id of the attribute |
value | string | value of the attribute |
type | string | Type is an optional prop that can be a string to identify a specific attribute |
Totalizers
It's an object with information about the prices in your cart
totalizer: {
items: 57696,
shipping:10000,
taxes:10000,
discounts: -1500,
total: 76196
}
Field | Type | Description |
---|---|---|
items | string | sum of all items.prices |
shipping | string | sum of all delivery.prices |
taxes | string | |
discounts | string | |
total | string |
Customer
It's an object with information about the user
"customer": {
"id": "15415421z2xc1as2c1s5ac4x5z9a",
"firstName": "Ruan",
"lastName": "Ollie",
"email": "[email protected]",
"phone": "169945721247",
"document": "32820736076"
}
Field | Type | Description |
---|---|---|
id | string | id of the user |
firstName | string | first name of the user |
lastName | string | last name of the user |
string | email of the user | |
phone | string | phone number of the user |
document | string | document of the user |
Shipping
It's an array of the user's addresses
{
addresses: [
{
id: "72301363c1c9440ea8caf14b1e589414",
addressLine1: "982 Will Drives",
addressLine2: "140 apartment",
state: "CR",
city: "Washington",
country: "USA",
postalCode: "24168"
}
]
}
Field | Type | Description |
---|---|---|
id | string | id of the address |
addresLine1 | string | first line of the address, including the street and number |
addresLine2 | string | additional address details, such as apartment, suite, or other relevant information for delivery |
state | string | state of the address |
city | string | city of the address |
country | string | country of the address |
postalCode | string | postal code of the address |
Delivery
{
selected: [
{
id: "Fedex-Last-Mile-101",
items: [
"e369db3a9eb34ea4800422972d805261",
"e2722d5fbaf743c0aa77bda31debb008",
"4a2b422131064b54a0a3a688bfb820fd"
],
name: "Fedex Express",
type: "delivery",
price: 555,
shippingEstimate: "1d",
addressId: "c05ea48d45574b6f8d5315fe3646cc7f"
}
]
}
Field | Type | Description |
---|---|---|
id | string | id of the delivery method |
items | array | array with lineId's representing the products that will be packaged for this delivery |
name | string | public facing name of this delivery method |
type | string | type of delivery (pickup or delivery) |
price | number | price of shipping (555 equals $5.55) |
shippingEstimate | string | arrival estimate in business days counting from date of the order |
addressId | string | id of the address used for this delivery |
Culture
It's an object with information about the localization of this cart
{
currency: "USD",
country: "USA",
locale: "en-US"
}
Payment
The payment section if composed of two objects: selected
which is the payment option selected by the user, and options
which lists all available payment methods for this cart.
"selected": [
{
"id": "2",
"value": 68370,
"referenceValue": 68370,
"paymentName": "Visa",
"planId": "c4ca4238a0b92da140dcc509a6f71455c"
}
],
"options": [
{
"id": "2",
"name": "Visa",
"type": "credit-card",
"plans": [
{
"id": "c4ca4238a0b92da140dcc509a6f71455c",
"installments": 1,
"interestRate": 0,
"installmentValue": 68370,
"totalAmount": 68370
}
]
}
]
Selected
It's an array of objects with the payments methods selected
Field | Type | Description |
---|---|---|
id | string | id of the payment method |
value | number | amount to be paid with this method |
referenceValue | number | value of the transaction (if you need to include interest or payment fees) |
planId | string | id of the payment plan (there might be multiple options to choose from the same payment method) |
Options
It's an array of objects for each payment options available for the cart
Field | Type | Description |
---|---|---|
id | string | id of the payment method |
name | array | amount to be paid with this method |
type | string | value of the transaction (if you need to include interest or payment fees) |
plans | array | id of the payment plan (there might be multiple options to choose from the same payment method) |
plans
Field | Type | Description |
---|---|---|
id | string | id of the payment plan |
installments | number | number of installments |
interestRate | number | value of interest to be paid |
installmentValue | number | value of installments |
totalAmount | number | total value to be transacted |