cart.update
curl --request POST \
--url https://merchant-url.com/api/cart_update \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"event": "cart.update",
"data": {
"order_reference": "order-12345",
"add_items": [
{
"product_id": "hat-123",
"price": 991,
"currency": "USD",
"quantity": 3
}
],
"remove_items": [
{
"product_id": "hat-123",
"quantity": 3
}
],
"discount_codes_to_add": [
"SUMMERFUN15"
],
"discount_codes_to_remove": [
"SUMMERFUN15"
],
"gift_cards_to_add": [
{
"card_number": "1111222233334444",
"pin": 123
}
],
"gift_cards_to_remove": [
{
"card_number": "1111222233334444",
"pin": 123
}
],
"loyalty_rewards_to_add": [
{
"amount": 1000,
"points": 1000,
"type": "coupon",
"coupon_code": "SUMMERSALE10",
"source": "yotpo",
"description": "Get $10 off your next order!",
"details": "{\"amount\": 10}"
}
],
"loyalty_rewards_to_remove": [
{
"amount": 1000,
"points": 1000,
"type": "coupon",
"coupon_code": "SUMMERSALE10",
"source": "yotpo",
"description": "Get $10 off your next order!",
"details": "{\"amount\": 10}"
}
],
"cart": {
"order_reference": "order-12345",
"display_id": "ID-12345",
"billing_address": {
"id": "addres-1",
"street_address1": "42 Wallaby Way",
"street_address2": "42 Wallaby Way",
"street_address3": "42 Wallaby Way",
"street_address4": "42 Wallaby Way",
"locality": "Wayne County",
"region": "Quebec",
"postal_code": "11209",
"country_code": "US",
"country": "Canada",
"name": "Charlotte Charles",
"first_name": "Charlotte",
"last_name": "Charles",
"company": "ACME Corp.",
"phone": "867-5309",
"email": "my.email@gmail.com"
},
"shipments": {
"shipping_address_id": "addres-1",
"shipping_address": {
"id": "addres-1",
"street_address1": "42 Wallaby Way",
"street_address2": "42 Wallaby Way",
"street_address3": "42 Wallaby Way",
"street_address4": "42 Wallaby Way",
"locality": "Wayne County",
"region": "Quebec",
"postal_code": "11209",
"country_code": "US",
"country": "Canada",
"name": "Charlotte Charles",
"first_name": "Charlotte",
"last_name": "Charles",
"company": "ACME Corp.",
"phone": "867-5309",
"email": "my.email@gmail.com"
},
"total_weight": 55,
"shipping_method": "Unknown",
"carrier": "FedEx",
"service": "Option 1",
"expedited": false,
"cost": 770,
"tax_amount": 230,
"package_type": "A big package.",
"package_width": 222,
"package_height": 103,
"package_depth": 90,
"package_dimension_unit": "cm",
"tax_code": "tax-12345",
"estimated_delivery_date": "08-30-2022",
"type": "A big package.",
"discount_by_membership": false
}
}
}
}
'import requests
url = "https://merchant-url.com/api/cart_update"
payload = {
"event": "cart.update",
"data": {
"order_reference": "order-12345",
"add_items": [
{
"product_id": "hat-123",
"price": 991,
"currency": "USD",
"quantity": 3
}
],
"remove_items": [
{
"product_id": "hat-123",
"quantity": 3
}
],
"discount_codes_to_add": ["SUMMERFUN15"],
"discount_codes_to_remove": ["SUMMERFUN15"],
"gift_cards_to_add": [
{
"card_number": "1111222233334444",
"pin": 123
}
],
"gift_cards_to_remove": [
{
"card_number": "1111222233334444",
"pin": 123
}
],
"loyalty_rewards_to_add": [
{
"amount": 1000,
"points": 1000,
"type": "coupon",
"coupon_code": "SUMMERSALE10",
"source": "yotpo",
"description": "Get $10 off your next order!",
"details": "{\"amount\": 10}"
}
],
"loyalty_rewards_to_remove": [
{
"amount": 1000,
"points": 1000,
"type": "coupon",
"coupon_code": "SUMMERSALE10",
"source": "yotpo",
"description": "Get $10 off your next order!",
"details": "{\"amount\": 10}"
}
],
"cart": {
"order_reference": "order-12345",
"display_id": "ID-12345",
"billing_address": {
"id": "addres-1",
"street_address1": "42 Wallaby Way",
"street_address2": "42 Wallaby Way",
"street_address3": "42 Wallaby Way",
"street_address4": "42 Wallaby Way",
"locality": "Wayne County",
"region": "Quebec",
"postal_code": "11209",
"country_code": "US",
"country": "Canada",
"name": "Charlotte Charles",
"first_name": "Charlotte",
"last_name": "Charles",
"company": "ACME Corp.",
"phone": "867-5309",
"email": "my.email@gmail.com"
},
"shipments": {
"shipping_address_id": "addres-1",
"shipping_address": {
"id": "addres-1",
"street_address1": "42 Wallaby Way",
"street_address2": "42 Wallaby Way",
"street_address3": "42 Wallaby Way",
"street_address4": "42 Wallaby Way",
"locality": "Wayne County",
"region": "Quebec",
"postal_code": "11209",
"country_code": "US",
"country": "Canada",
"name": "Charlotte Charles",
"first_name": "Charlotte",
"last_name": "Charles",
"company": "ACME Corp.",
"phone": "867-5309",
"email": "my.email@gmail.com"
},
"total_weight": 55,
"shipping_method": "Unknown",
"carrier": "FedEx",
"service": "Option 1",
"expedited": False,
"cost": 770,
"tax_amount": 230,
"package_type": "A big package.",
"package_width": 222,
"package_height": 103,
"package_depth": 90,
"package_dimension_unit": "cm",
"tax_code": "tax-12345",
"estimated_delivery_date": "08-30-2022",
"type": "A big package.",
"discount_by_membership": False
}
}
}
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
event: 'cart.update',
data: {
order_reference: 'order-12345',
add_items: [{product_id: 'hat-123', price: 991, currency: 'USD', quantity: 3}],
remove_items: [{product_id: 'hat-123', quantity: 3}],
discount_codes_to_add: ['SUMMERFUN15'],
discount_codes_to_remove: ['SUMMERFUN15'],
gift_cards_to_add: [{card_number: '1111222233334444', pin: 123}],
gift_cards_to_remove: [{card_number: '1111222233334444', pin: 123}],
loyalty_rewards_to_add: [
{
amount: 1000,
points: 1000,
type: 'coupon',
coupon_code: 'SUMMERSALE10',
source: 'yotpo',
description: 'Get $10 off your next order!',
details: '{"amount": 10}'
}
],
loyalty_rewards_to_remove: [
{
amount: 1000,
points: 1000,
type: 'coupon',
coupon_code: 'SUMMERSALE10',
source: 'yotpo',
description: 'Get $10 off your next order!',
details: '{"amount": 10}'
}
],
cart: {
order_reference: 'order-12345',
display_id: 'ID-12345',
billing_address: {
id: 'addres-1',
street_address1: '42 Wallaby Way',
street_address2: '42 Wallaby Way',
street_address3: '42 Wallaby Way',
street_address4: '42 Wallaby Way',
locality: 'Wayne County',
region: 'Quebec',
postal_code: '11209',
country_code: 'US',
country: 'Canada',
name: 'Charlotte Charles',
first_name: 'Charlotte',
last_name: 'Charles',
company: 'ACME Corp.',
phone: '867-5309',
email: 'my.email@gmail.com'
},
shipments: {
shipping_address_id: 'addres-1',
shipping_address: {
id: 'addres-1',
street_address1: '42 Wallaby Way',
street_address2: '42 Wallaby Way',
street_address3: '42 Wallaby Way',
street_address4: '42 Wallaby Way',
locality: 'Wayne County',
region: 'Quebec',
postal_code: '11209',
country_code: 'US',
country: 'Canada',
name: 'Charlotte Charles',
first_name: 'Charlotte',
last_name: 'Charles',
company: 'ACME Corp.',
phone: '867-5309',
email: 'my.email@gmail.com'
},
total_weight: 55,
shipping_method: 'Unknown',
carrier: 'FedEx',
service: 'Option 1',
expedited: false,
cost: 770,
tax_amount: 230,
package_type: 'A big package.',
package_width: 222,
package_height: 103,
package_depth: 90,
package_dimension_unit: 'cm',
tax_code: 'tax-12345',
estimated_delivery_date: '08-30-2022',
type: 'A big package.',
discount_by_membership: false
}
}
}
})
};
fetch('https://merchant-url.com/api/cart_update', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://merchant-url.com/api/cart_update",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'event' => 'cart.update',
'data' => [
'order_reference' => 'order-12345',
'add_items' => [
[
'product_id' => 'hat-123',
'price' => 991,
'currency' => 'USD',
'quantity' => 3
]
],
'remove_items' => [
[
'product_id' => 'hat-123',
'quantity' => 3
]
],
'discount_codes_to_add' => [
'SUMMERFUN15'
],
'discount_codes_to_remove' => [
'SUMMERFUN15'
],
'gift_cards_to_add' => [
[
'card_number' => '1111222233334444',
'pin' => 123
]
],
'gift_cards_to_remove' => [
[
'card_number' => '1111222233334444',
'pin' => 123
]
],
'loyalty_rewards_to_add' => [
[
'amount' => 1000,
'points' => 1000,
'type' => 'coupon',
'coupon_code' => 'SUMMERSALE10',
'source' => 'yotpo',
'description' => 'Get $10 off your next order!',
'details' => '{"amount": 10}'
]
],
'loyalty_rewards_to_remove' => [
[
'amount' => 1000,
'points' => 1000,
'type' => 'coupon',
'coupon_code' => 'SUMMERSALE10',
'source' => 'yotpo',
'description' => 'Get $10 off your next order!',
'details' => '{"amount": 10}'
]
],
'cart' => [
'order_reference' => 'order-12345',
'display_id' => 'ID-12345',
'billing_address' => [
'id' => 'addres-1',
'street_address1' => '42 Wallaby Way',
'street_address2' => '42 Wallaby Way',
'street_address3' => '42 Wallaby Way',
'street_address4' => '42 Wallaby Way',
'locality' => 'Wayne County',
'region' => 'Quebec',
'postal_code' => '11209',
'country_code' => 'US',
'country' => 'Canada',
'name' => 'Charlotte Charles',
'first_name' => 'Charlotte',
'last_name' => 'Charles',
'company' => 'ACME Corp.',
'phone' => '867-5309',
'email' => 'my.email@gmail.com'
],
'shipments' => [
'shipping_address_id' => 'addres-1',
'shipping_address' => [
'id' => 'addres-1',
'street_address1' => '42 Wallaby Way',
'street_address2' => '42 Wallaby Way',
'street_address3' => '42 Wallaby Way',
'street_address4' => '42 Wallaby Way',
'locality' => 'Wayne County',
'region' => 'Quebec',
'postal_code' => '11209',
'country_code' => 'US',
'country' => 'Canada',
'name' => 'Charlotte Charles',
'first_name' => 'Charlotte',
'last_name' => 'Charles',
'company' => 'ACME Corp.',
'phone' => '867-5309',
'email' => 'my.email@gmail.com'
],
'total_weight' => 55,
'shipping_method' => 'Unknown',
'carrier' => 'FedEx',
'service' => 'Option 1',
'expedited' => false,
'cost' => 770,
'tax_amount' => 230,
'package_type' => 'A big package.',
'package_width' => 222,
'package_height' => 103,
'package_depth' => 90,
'package_dimension_unit' => 'cm',
'tax_code' => 'tax-12345',
'estimated_delivery_date' => '08-30-2022',
'type' => 'A big package.',
'discount_by_membership' => false
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://merchant-url.com/api/cart_update"
payload := strings.NewReader("{\n \"event\": \"cart.update\",\n \"data\": {\n \"order_reference\": \"order-12345\",\n \"add_items\": [\n {\n \"product_id\": \"hat-123\",\n \"price\": 991,\n \"currency\": \"USD\",\n \"quantity\": 3\n }\n ],\n \"remove_items\": [\n {\n \"product_id\": \"hat-123\",\n \"quantity\": 3\n }\n ],\n \"discount_codes_to_add\": [\n \"SUMMERFUN15\"\n ],\n \"discount_codes_to_remove\": [\n \"SUMMERFUN15\"\n ],\n \"gift_cards_to_add\": [\n {\n \"card_number\": \"1111222233334444\",\n \"pin\": 123\n }\n ],\n \"gift_cards_to_remove\": [\n {\n \"card_number\": \"1111222233334444\",\n \"pin\": 123\n }\n ],\n \"loyalty_rewards_to_add\": [\n {\n \"amount\": 1000,\n \"points\": 1000,\n \"type\": \"coupon\",\n \"coupon_code\": \"SUMMERSALE10\",\n \"source\": \"yotpo\",\n \"description\": \"Get $10 off your next order!\",\n \"details\": \"{\\\"amount\\\": 10}\"\n }\n ],\n \"loyalty_rewards_to_remove\": [\n {\n \"amount\": 1000,\n \"points\": 1000,\n \"type\": \"coupon\",\n \"coupon_code\": \"SUMMERSALE10\",\n \"source\": \"yotpo\",\n \"description\": \"Get $10 off your next order!\",\n \"details\": \"{\\\"amount\\\": 10}\"\n }\n ],\n \"cart\": {\n \"order_reference\": \"order-12345\",\n \"display_id\": \"ID-12345\",\n \"billing_address\": {\n \"id\": \"addres-1\",\n \"street_address1\": \"42 Wallaby Way\",\n \"street_address2\": \"42 Wallaby Way\",\n \"street_address3\": \"42 Wallaby Way\",\n \"street_address4\": \"42 Wallaby Way\",\n \"locality\": \"Wayne County\",\n \"region\": \"Quebec\",\n \"postal_code\": \"11209\",\n \"country_code\": \"US\",\n \"country\": \"Canada\",\n \"name\": \"Charlotte Charles\",\n \"first_name\": \"Charlotte\",\n \"last_name\": \"Charles\",\n \"company\": \"ACME Corp.\",\n \"phone\": \"867-5309\",\n \"email\": \"my.email@gmail.com\"\n },\n \"shipments\": {\n \"shipping_address_id\": \"addres-1\",\n \"shipping_address\": {\n \"id\": \"addres-1\",\n \"street_address1\": \"42 Wallaby Way\",\n \"street_address2\": \"42 Wallaby Way\",\n \"street_address3\": \"42 Wallaby Way\",\n \"street_address4\": \"42 Wallaby Way\",\n \"locality\": \"Wayne County\",\n \"region\": \"Quebec\",\n \"postal_code\": \"11209\",\n \"country_code\": \"US\",\n \"country\": \"Canada\",\n \"name\": \"Charlotte Charles\",\n \"first_name\": \"Charlotte\",\n \"last_name\": \"Charles\",\n \"company\": \"ACME Corp.\",\n \"phone\": \"867-5309\",\n \"email\": \"my.email@gmail.com\"\n },\n \"total_weight\": 55,\n \"shipping_method\": \"Unknown\",\n \"carrier\": \"FedEx\",\n \"service\": \"Option 1\",\n \"expedited\": false,\n \"cost\": 770,\n \"tax_amount\": 230,\n \"package_type\": \"A big package.\",\n \"package_width\": 222,\n \"package_height\": 103,\n \"package_depth\": 90,\n \"package_dimension_unit\": \"cm\",\n \"tax_code\": \"tax-12345\",\n \"estimated_delivery_date\": \"08-30-2022\",\n \"type\": \"A big package.\",\n \"discount_by_membership\": false\n }\n }\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-Key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://merchant-url.com/api/cart_update")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"event\": \"cart.update\",\n \"data\": {\n \"order_reference\": \"order-12345\",\n \"add_items\": [\n {\n \"product_id\": \"hat-123\",\n \"price\": 991,\n \"currency\": \"USD\",\n \"quantity\": 3\n }\n ],\n \"remove_items\": [\n {\n \"product_id\": \"hat-123\",\n \"quantity\": 3\n }\n ],\n \"discount_codes_to_add\": [\n \"SUMMERFUN15\"\n ],\n \"discount_codes_to_remove\": [\n \"SUMMERFUN15\"\n ],\n \"gift_cards_to_add\": [\n {\n \"card_number\": \"1111222233334444\",\n \"pin\": 123\n }\n ],\n \"gift_cards_to_remove\": [\n {\n \"card_number\": \"1111222233334444\",\n \"pin\": 123\n }\n ],\n \"loyalty_rewards_to_add\": [\n {\n \"amount\": 1000,\n \"points\": 1000,\n \"type\": \"coupon\",\n \"coupon_code\": \"SUMMERSALE10\",\n \"source\": \"yotpo\",\n \"description\": \"Get $10 off your next order!\",\n \"details\": \"{\\\"amount\\\": 10}\"\n }\n ],\n \"loyalty_rewards_to_remove\": [\n {\n \"amount\": 1000,\n \"points\": 1000,\n \"type\": \"coupon\",\n \"coupon_code\": \"SUMMERSALE10\",\n \"source\": \"yotpo\",\n \"description\": \"Get $10 off your next order!\",\n \"details\": \"{\\\"amount\\\": 10}\"\n }\n ],\n \"cart\": {\n \"order_reference\": \"order-12345\",\n \"display_id\": \"ID-12345\",\n \"billing_address\": {\n \"id\": \"addres-1\",\n \"street_address1\": \"42 Wallaby Way\",\n \"street_address2\": \"42 Wallaby Way\",\n \"street_address3\": \"42 Wallaby Way\",\n \"street_address4\": \"42 Wallaby Way\",\n \"locality\": \"Wayne County\",\n \"region\": \"Quebec\",\n \"postal_code\": \"11209\",\n \"country_code\": \"US\",\n \"country\": \"Canada\",\n \"name\": \"Charlotte Charles\",\n \"first_name\": \"Charlotte\",\n \"last_name\": \"Charles\",\n \"company\": \"ACME Corp.\",\n \"phone\": \"867-5309\",\n \"email\": \"my.email@gmail.com\"\n },\n \"shipments\": {\n \"shipping_address_id\": \"addres-1\",\n \"shipping_address\": {\n \"id\": \"addres-1\",\n \"street_address1\": \"42 Wallaby Way\",\n \"street_address2\": \"42 Wallaby Way\",\n \"street_address3\": \"42 Wallaby Way\",\n \"street_address4\": \"42 Wallaby Way\",\n \"locality\": \"Wayne County\",\n \"region\": \"Quebec\",\n \"postal_code\": \"11209\",\n \"country_code\": \"US\",\n \"country\": \"Canada\",\n \"name\": \"Charlotte Charles\",\n \"first_name\": \"Charlotte\",\n \"last_name\": \"Charles\",\n \"company\": \"ACME Corp.\",\n \"phone\": \"867-5309\",\n \"email\": \"my.email@gmail.com\"\n },\n \"total_weight\": 55,\n \"shipping_method\": \"Unknown\",\n \"carrier\": \"FedEx\",\n \"service\": \"Option 1\",\n \"expedited\": false,\n \"cost\": 770,\n \"tax_amount\": 230,\n \"package_type\": \"A big package.\",\n \"package_width\": 222,\n \"package_height\": 103,\n \"package_depth\": 90,\n \"package_dimension_unit\": \"cm\",\n \"tax_code\": \"tax-12345\",\n \"estimated_delivery_date\": \"08-30-2022\",\n \"type\": \"A big package.\",\n \"discount_by_membership\": false\n }\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://merchant-url.com/api/cart_update")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"event\": \"cart.update\",\n \"data\": {\n \"order_reference\": \"order-12345\",\n \"add_items\": [\n {\n \"product_id\": \"hat-123\",\n \"price\": 991,\n \"currency\": \"USD\",\n \"quantity\": 3\n }\n ],\n \"remove_items\": [\n {\n \"product_id\": \"hat-123\",\n \"quantity\": 3\n }\n ],\n \"discount_codes_to_add\": [\n \"SUMMERFUN15\"\n ],\n \"discount_codes_to_remove\": [\n \"SUMMERFUN15\"\n ],\n \"gift_cards_to_add\": [\n {\n \"card_number\": \"1111222233334444\",\n \"pin\": 123\n }\n ],\n \"gift_cards_to_remove\": [\n {\n \"card_number\": \"1111222233334444\",\n \"pin\": 123\n }\n ],\n \"loyalty_rewards_to_add\": [\n {\n \"amount\": 1000,\n \"points\": 1000,\n \"type\": \"coupon\",\n \"coupon_code\": \"SUMMERSALE10\",\n \"source\": \"yotpo\",\n \"description\": \"Get $10 off your next order!\",\n \"details\": \"{\\\"amount\\\": 10}\"\n }\n ],\n \"loyalty_rewards_to_remove\": [\n {\n \"amount\": 1000,\n \"points\": 1000,\n \"type\": \"coupon\",\n \"coupon_code\": \"SUMMERSALE10\",\n \"source\": \"yotpo\",\n \"description\": \"Get $10 off your next order!\",\n \"details\": \"{\\\"amount\\\": 10}\"\n }\n ],\n \"cart\": {\n \"order_reference\": \"order-12345\",\n \"display_id\": \"ID-12345\",\n \"billing_address\": {\n \"id\": \"addres-1\",\n \"street_address1\": \"42 Wallaby Way\",\n \"street_address2\": \"42 Wallaby Way\",\n \"street_address3\": \"42 Wallaby Way\",\n \"street_address4\": \"42 Wallaby Way\",\n \"locality\": \"Wayne County\",\n \"region\": \"Quebec\",\n \"postal_code\": \"11209\",\n \"country_code\": \"US\",\n \"country\": \"Canada\",\n \"name\": \"Charlotte Charles\",\n \"first_name\": \"Charlotte\",\n \"last_name\": \"Charles\",\n \"company\": \"ACME Corp.\",\n \"phone\": \"867-5309\",\n \"email\": \"my.email@gmail.com\"\n },\n \"shipments\": {\n \"shipping_address_id\": \"addres-1\",\n \"shipping_address\": {\n \"id\": \"addres-1\",\n \"street_address1\": \"42 Wallaby Way\",\n \"street_address2\": \"42 Wallaby Way\",\n \"street_address3\": \"42 Wallaby Way\",\n \"street_address4\": \"42 Wallaby Way\",\n \"locality\": \"Wayne County\",\n \"region\": \"Quebec\",\n \"postal_code\": \"11209\",\n \"country_code\": \"US\",\n \"country\": \"Canada\",\n \"name\": \"Charlotte Charles\",\n \"first_name\": \"Charlotte\",\n \"last_name\": \"Charles\",\n \"company\": \"ACME Corp.\",\n \"phone\": \"867-5309\",\n \"email\": \"my.email@gmail.com\"\n },\n \"total_weight\": 55,\n \"shipping_method\": \"Unknown\",\n \"carrier\": \"FedEx\",\n \"service\": \"Option 1\",\n \"expedited\": false,\n \"cost\": 770,\n \"tax_amount\": 230,\n \"package_type\": \"A big package.\",\n \"package_width\": 222,\n \"package_height\": 103,\n \"package_depth\": 90,\n \"package_dimension_unit\": \"cm\",\n \"tax_code\": \"tax-12345\",\n \"estimated_delivery_date\": \"08-30-2022\",\n \"type\": \"A big package.\",\n \"discount_by_membership\": false\n }\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"event": "cart.update",
"status": "success",
"data": {
"order_create": {
"cart": {
"currency": "USD",
"total_amount": 9900,
"items": [
{
"reference": "1123",
"name": "Blue Hat",
"total_amount": 9900,
"unit_price": 500,
"quantity": 3,
"description": " Large blue satin hat with initials embroidered.",
"options": "string option",
"tax_amount": {
"amount": 754,
"currency": "USD",
"currency_symbol": "$"
},
"uom": "string",
"upc": "string",
"sku": "SKU-11021",
"isbn": "12-345-678-90123",
"brand": "Bolt Swagstore",
"manufacturer": "Bolt Factory",
"category": "hats",
"collections": [
"summer"
],
"tags": "red",
"color": "Red",
"size": "XXL",
"weight": {
"weight": 22,
"unit": "kg"
},
"image_url": "https://boltswagstore.com/inventory/hats/red-hat.png",
"details_url": "https://boltswagstore.com/inventory/hats/red-hat.png",
"type": "physical",
"taxable": true,
"properties": [
{
"name": "a-name",
"value": "a-value"
}
],
"item_group": "Ships Immediately",
"shipment_type": "unknown",
"customizations": [
{
"name": "Bedazzled",
"price": {
"amount": 754,
"currency": "USD",
"currency_symbol": "$"
},
"attributes": {
"key1": "value1",
"key2": "value2"
}
}
],
"bolt_product_id": "e2bb0e7e-5625-536f-8ad7-25a26537ee28",
"gift_options": {
"wrap": false,
"merchant_product_id": "881",
"message": "Happy Anniversary, Smoochy Poo!",
"cost": 785
}
}
],
"discounts": [
{
"amount": {
"amount": 754,
"currency": "USD",
"currency_symbol": "$"
},
"code": "SUMMERFUN15",
"reference": "SUMMERFUN15",
"description": "Take 15% off of your order.",
"details_url": "https://boltswagstore.com/discounts/#12345",
"free_shipping": {
"is_free_shipping": false,
"maximum_cost_allowed": 100
},
"discount_category": "coupon"
}
],
"order_reference": "order-12345",
"display_id": "ID-12345",
"cart_url": "https://boltswagstore.com/orders/123456765432",
"metadata": [
{
"key1": "value 1"
}
]
}
}
}
}{
"event": "cart.update",
"status": "failure",
"errors": [
{
"code": 2001005,
"data": [
{
"reason": "This product is out of stock."
}
]
}
]
}Cart
cart.update
This request updates the shopper’s cart with any changes, such as adding or removing items.
POST
/
cart_update
cart.update
curl --request POST \
--url https://merchant-url.com/api/cart_update \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"event": "cart.update",
"data": {
"order_reference": "order-12345",
"add_items": [
{
"product_id": "hat-123",
"price": 991,
"currency": "USD",
"quantity": 3
}
],
"remove_items": [
{
"product_id": "hat-123",
"quantity": 3
}
],
"discount_codes_to_add": [
"SUMMERFUN15"
],
"discount_codes_to_remove": [
"SUMMERFUN15"
],
"gift_cards_to_add": [
{
"card_number": "1111222233334444",
"pin": 123
}
],
"gift_cards_to_remove": [
{
"card_number": "1111222233334444",
"pin": 123
}
],
"loyalty_rewards_to_add": [
{
"amount": 1000,
"points": 1000,
"type": "coupon",
"coupon_code": "SUMMERSALE10",
"source": "yotpo",
"description": "Get $10 off your next order!",
"details": "{\"amount\": 10}"
}
],
"loyalty_rewards_to_remove": [
{
"amount": 1000,
"points": 1000,
"type": "coupon",
"coupon_code": "SUMMERSALE10",
"source": "yotpo",
"description": "Get $10 off your next order!",
"details": "{\"amount\": 10}"
}
],
"cart": {
"order_reference": "order-12345",
"display_id": "ID-12345",
"billing_address": {
"id": "addres-1",
"street_address1": "42 Wallaby Way",
"street_address2": "42 Wallaby Way",
"street_address3": "42 Wallaby Way",
"street_address4": "42 Wallaby Way",
"locality": "Wayne County",
"region": "Quebec",
"postal_code": "11209",
"country_code": "US",
"country": "Canada",
"name": "Charlotte Charles",
"first_name": "Charlotte",
"last_name": "Charles",
"company": "ACME Corp.",
"phone": "867-5309",
"email": "my.email@gmail.com"
},
"shipments": {
"shipping_address_id": "addres-1",
"shipping_address": {
"id": "addres-1",
"street_address1": "42 Wallaby Way",
"street_address2": "42 Wallaby Way",
"street_address3": "42 Wallaby Way",
"street_address4": "42 Wallaby Way",
"locality": "Wayne County",
"region": "Quebec",
"postal_code": "11209",
"country_code": "US",
"country": "Canada",
"name": "Charlotte Charles",
"first_name": "Charlotte",
"last_name": "Charles",
"company": "ACME Corp.",
"phone": "867-5309",
"email": "my.email@gmail.com"
},
"total_weight": 55,
"shipping_method": "Unknown",
"carrier": "FedEx",
"service": "Option 1",
"expedited": false,
"cost": 770,
"tax_amount": 230,
"package_type": "A big package.",
"package_width": 222,
"package_height": 103,
"package_depth": 90,
"package_dimension_unit": "cm",
"tax_code": "tax-12345",
"estimated_delivery_date": "08-30-2022",
"type": "A big package.",
"discount_by_membership": false
}
}
}
}
'import requests
url = "https://merchant-url.com/api/cart_update"
payload = {
"event": "cart.update",
"data": {
"order_reference": "order-12345",
"add_items": [
{
"product_id": "hat-123",
"price": 991,
"currency": "USD",
"quantity": 3
}
],
"remove_items": [
{
"product_id": "hat-123",
"quantity": 3
}
],
"discount_codes_to_add": ["SUMMERFUN15"],
"discount_codes_to_remove": ["SUMMERFUN15"],
"gift_cards_to_add": [
{
"card_number": "1111222233334444",
"pin": 123
}
],
"gift_cards_to_remove": [
{
"card_number": "1111222233334444",
"pin": 123
}
],
"loyalty_rewards_to_add": [
{
"amount": 1000,
"points": 1000,
"type": "coupon",
"coupon_code": "SUMMERSALE10",
"source": "yotpo",
"description": "Get $10 off your next order!",
"details": "{\"amount\": 10}"
}
],
"loyalty_rewards_to_remove": [
{
"amount": 1000,
"points": 1000,
"type": "coupon",
"coupon_code": "SUMMERSALE10",
"source": "yotpo",
"description": "Get $10 off your next order!",
"details": "{\"amount\": 10}"
}
],
"cart": {
"order_reference": "order-12345",
"display_id": "ID-12345",
"billing_address": {
"id": "addres-1",
"street_address1": "42 Wallaby Way",
"street_address2": "42 Wallaby Way",
"street_address3": "42 Wallaby Way",
"street_address4": "42 Wallaby Way",
"locality": "Wayne County",
"region": "Quebec",
"postal_code": "11209",
"country_code": "US",
"country": "Canada",
"name": "Charlotte Charles",
"first_name": "Charlotte",
"last_name": "Charles",
"company": "ACME Corp.",
"phone": "867-5309",
"email": "my.email@gmail.com"
},
"shipments": {
"shipping_address_id": "addres-1",
"shipping_address": {
"id": "addres-1",
"street_address1": "42 Wallaby Way",
"street_address2": "42 Wallaby Way",
"street_address3": "42 Wallaby Way",
"street_address4": "42 Wallaby Way",
"locality": "Wayne County",
"region": "Quebec",
"postal_code": "11209",
"country_code": "US",
"country": "Canada",
"name": "Charlotte Charles",
"first_name": "Charlotte",
"last_name": "Charles",
"company": "ACME Corp.",
"phone": "867-5309",
"email": "my.email@gmail.com"
},
"total_weight": 55,
"shipping_method": "Unknown",
"carrier": "FedEx",
"service": "Option 1",
"expedited": False,
"cost": 770,
"tax_amount": 230,
"package_type": "A big package.",
"package_width": 222,
"package_height": 103,
"package_depth": 90,
"package_dimension_unit": "cm",
"tax_code": "tax-12345",
"estimated_delivery_date": "08-30-2022",
"type": "A big package.",
"discount_by_membership": False
}
}
}
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
event: 'cart.update',
data: {
order_reference: 'order-12345',
add_items: [{product_id: 'hat-123', price: 991, currency: 'USD', quantity: 3}],
remove_items: [{product_id: 'hat-123', quantity: 3}],
discount_codes_to_add: ['SUMMERFUN15'],
discount_codes_to_remove: ['SUMMERFUN15'],
gift_cards_to_add: [{card_number: '1111222233334444', pin: 123}],
gift_cards_to_remove: [{card_number: '1111222233334444', pin: 123}],
loyalty_rewards_to_add: [
{
amount: 1000,
points: 1000,
type: 'coupon',
coupon_code: 'SUMMERSALE10',
source: 'yotpo',
description: 'Get $10 off your next order!',
details: '{"amount": 10}'
}
],
loyalty_rewards_to_remove: [
{
amount: 1000,
points: 1000,
type: 'coupon',
coupon_code: 'SUMMERSALE10',
source: 'yotpo',
description: 'Get $10 off your next order!',
details: '{"amount": 10}'
}
],
cart: {
order_reference: 'order-12345',
display_id: 'ID-12345',
billing_address: {
id: 'addres-1',
street_address1: '42 Wallaby Way',
street_address2: '42 Wallaby Way',
street_address3: '42 Wallaby Way',
street_address4: '42 Wallaby Way',
locality: 'Wayne County',
region: 'Quebec',
postal_code: '11209',
country_code: 'US',
country: 'Canada',
name: 'Charlotte Charles',
first_name: 'Charlotte',
last_name: 'Charles',
company: 'ACME Corp.',
phone: '867-5309',
email: 'my.email@gmail.com'
},
shipments: {
shipping_address_id: 'addres-1',
shipping_address: {
id: 'addres-1',
street_address1: '42 Wallaby Way',
street_address2: '42 Wallaby Way',
street_address3: '42 Wallaby Way',
street_address4: '42 Wallaby Way',
locality: 'Wayne County',
region: 'Quebec',
postal_code: '11209',
country_code: 'US',
country: 'Canada',
name: 'Charlotte Charles',
first_name: 'Charlotte',
last_name: 'Charles',
company: 'ACME Corp.',
phone: '867-5309',
email: 'my.email@gmail.com'
},
total_weight: 55,
shipping_method: 'Unknown',
carrier: 'FedEx',
service: 'Option 1',
expedited: false,
cost: 770,
tax_amount: 230,
package_type: 'A big package.',
package_width: 222,
package_height: 103,
package_depth: 90,
package_dimension_unit: 'cm',
tax_code: 'tax-12345',
estimated_delivery_date: '08-30-2022',
type: 'A big package.',
discount_by_membership: false
}
}
}
})
};
fetch('https://merchant-url.com/api/cart_update', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://merchant-url.com/api/cart_update",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'event' => 'cart.update',
'data' => [
'order_reference' => 'order-12345',
'add_items' => [
[
'product_id' => 'hat-123',
'price' => 991,
'currency' => 'USD',
'quantity' => 3
]
],
'remove_items' => [
[
'product_id' => 'hat-123',
'quantity' => 3
]
],
'discount_codes_to_add' => [
'SUMMERFUN15'
],
'discount_codes_to_remove' => [
'SUMMERFUN15'
],
'gift_cards_to_add' => [
[
'card_number' => '1111222233334444',
'pin' => 123
]
],
'gift_cards_to_remove' => [
[
'card_number' => '1111222233334444',
'pin' => 123
]
],
'loyalty_rewards_to_add' => [
[
'amount' => 1000,
'points' => 1000,
'type' => 'coupon',
'coupon_code' => 'SUMMERSALE10',
'source' => 'yotpo',
'description' => 'Get $10 off your next order!',
'details' => '{"amount": 10}'
]
],
'loyalty_rewards_to_remove' => [
[
'amount' => 1000,
'points' => 1000,
'type' => 'coupon',
'coupon_code' => 'SUMMERSALE10',
'source' => 'yotpo',
'description' => 'Get $10 off your next order!',
'details' => '{"amount": 10}'
]
],
'cart' => [
'order_reference' => 'order-12345',
'display_id' => 'ID-12345',
'billing_address' => [
'id' => 'addres-1',
'street_address1' => '42 Wallaby Way',
'street_address2' => '42 Wallaby Way',
'street_address3' => '42 Wallaby Way',
'street_address4' => '42 Wallaby Way',
'locality' => 'Wayne County',
'region' => 'Quebec',
'postal_code' => '11209',
'country_code' => 'US',
'country' => 'Canada',
'name' => 'Charlotte Charles',
'first_name' => 'Charlotte',
'last_name' => 'Charles',
'company' => 'ACME Corp.',
'phone' => '867-5309',
'email' => 'my.email@gmail.com'
],
'shipments' => [
'shipping_address_id' => 'addres-1',
'shipping_address' => [
'id' => 'addres-1',
'street_address1' => '42 Wallaby Way',
'street_address2' => '42 Wallaby Way',
'street_address3' => '42 Wallaby Way',
'street_address4' => '42 Wallaby Way',
'locality' => 'Wayne County',
'region' => 'Quebec',
'postal_code' => '11209',
'country_code' => 'US',
'country' => 'Canada',
'name' => 'Charlotte Charles',
'first_name' => 'Charlotte',
'last_name' => 'Charles',
'company' => 'ACME Corp.',
'phone' => '867-5309',
'email' => 'my.email@gmail.com'
],
'total_weight' => 55,
'shipping_method' => 'Unknown',
'carrier' => 'FedEx',
'service' => 'Option 1',
'expedited' => false,
'cost' => 770,
'tax_amount' => 230,
'package_type' => 'A big package.',
'package_width' => 222,
'package_height' => 103,
'package_depth' => 90,
'package_dimension_unit' => 'cm',
'tax_code' => 'tax-12345',
'estimated_delivery_date' => '08-30-2022',
'type' => 'A big package.',
'discount_by_membership' => false
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://merchant-url.com/api/cart_update"
payload := strings.NewReader("{\n \"event\": \"cart.update\",\n \"data\": {\n \"order_reference\": \"order-12345\",\n \"add_items\": [\n {\n \"product_id\": \"hat-123\",\n \"price\": 991,\n \"currency\": \"USD\",\n \"quantity\": 3\n }\n ],\n \"remove_items\": [\n {\n \"product_id\": \"hat-123\",\n \"quantity\": 3\n }\n ],\n \"discount_codes_to_add\": [\n \"SUMMERFUN15\"\n ],\n \"discount_codes_to_remove\": [\n \"SUMMERFUN15\"\n ],\n \"gift_cards_to_add\": [\n {\n \"card_number\": \"1111222233334444\",\n \"pin\": 123\n }\n ],\n \"gift_cards_to_remove\": [\n {\n \"card_number\": \"1111222233334444\",\n \"pin\": 123\n }\n ],\n \"loyalty_rewards_to_add\": [\n {\n \"amount\": 1000,\n \"points\": 1000,\n \"type\": \"coupon\",\n \"coupon_code\": \"SUMMERSALE10\",\n \"source\": \"yotpo\",\n \"description\": \"Get $10 off your next order!\",\n \"details\": \"{\\\"amount\\\": 10}\"\n }\n ],\n \"loyalty_rewards_to_remove\": [\n {\n \"amount\": 1000,\n \"points\": 1000,\n \"type\": \"coupon\",\n \"coupon_code\": \"SUMMERSALE10\",\n \"source\": \"yotpo\",\n \"description\": \"Get $10 off your next order!\",\n \"details\": \"{\\\"amount\\\": 10}\"\n }\n ],\n \"cart\": {\n \"order_reference\": \"order-12345\",\n \"display_id\": \"ID-12345\",\n \"billing_address\": {\n \"id\": \"addres-1\",\n \"street_address1\": \"42 Wallaby Way\",\n \"street_address2\": \"42 Wallaby Way\",\n \"street_address3\": \"42 Wallaby Way\",\n \"street_address4\": \"42 Wallaby Way\",\n \"locality\": \"Wayne County\",\n \"region\": \"Quebec\",\n \"postal_code\": \"11209\",\n \"country_code\": \"US\",\n \"country\": \"Canada\",\n \"name\": \"Charlotte Charles\",\n \"first_name\": \"Charlotte\",\n \"last_name\": \"Charles\",\n \"company\": \"ACME Corp.\",\n \"phone\": \"867-5309\",\n \"email\": \"my.email@gmail.com\"\n },\n \"shipments\": {\n \"shipping_address_id\": \"addres-1\",\n \"shipping_address\": {\n \"id\": \"addres-1\",\n \"street_address1\": \"42 Wallaby Way\",\n \"street_address2\": \"42 Wallaby Way\",\n \"street_address3\": \"42 Wallaby Way\",\n \"street_address4\": \"42 Wallaby Way\",\n \"locality\": \"Wayne County\",\n \"region\": \"Quebec\",\n \"postal_code\": \"11209\",\n \"country_code\": \"US\",\n \"country\": \"Canada\",\n \"name\": \"Charlotte Charles\",\n \"first_name\": \"Charlotte\",\n \"last_name\": \"Charles\",\n \"company\": \"ACME Corp.\",\n \"phone\": \"867-5309\",\n \"email\": \"my.email@gmail.com\"\n },\n \"total_weight\": 55,\n \"shipping_method\": \"Unknown\",\n \"carrier\": \"FedEx\",\n \"service\": \"Option 1\",\n \"expedited\": false,\n \"cost\": 770,\n \"tax_amount\": 230,\n \"package_type\": \"A big package.\",\n \"package_width\": 222,\n \"package_height\": 103,\n \"package_depth\": 90,\n \"package_dimension_unit\": \"cm\",\n \"tax_code\": \"tax-12345\",\n \"estimated_delivery_date\": \"08-30-2022\",\n \"type\": \"A big package.\",\n \"discount_by_membership\": false\n }\n }\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-Key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://merchant-url.com/api/cart_update")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"event\": \"cart.update\",\n \"data\": {\n \"order_reference\": \"order-12345\",\n \"add_items\": [\n {\n \"product_id\": \"hat-123\",\n \"price\": 991,\n \"currency\": \"USD\",\n \"quantity\": 3\n }\n ],\n \"remove_items\": [\n {\n \"product_id\": \"hat-123\",\n \"quantity\": 3\n }\n ],\n \"discount_codes_to_add\": [\n \"SUMMERFUN15\"\n ],\n \"discount_codes_to_remove\": [\n \"SUMMERFUN15\"\n ],\n \"gift_cards_to_add\": [\n {\n \"card_number\": \"1111222233334444\",\n \"pin\": 123\n }\n ],\n \"gift_cards_to_remove\": [\n {\n \"card_number\": \"1111222233334444\",\n \"pin\": 123\n }\n ],\n \"loyalty_rewards_to_add\": [\n {\n \"amount\": 1000,\n \"points\": 1000,\n \"type\": \"coupon\",\n \"coupon_code\": \"SUMMERSALE10\",\n \"source\": \"yotpo\",\n \"description\": \"Get $10 off your next order!\",\n \"details\": \"{\\\"amount\\\": 10}\"\n }\n ],\n \"loyalty_rewards_to_remove\": [\n {\n \"amount\": 1000,\n \"points\": 1000,\n \"type\": \"coupon\",\n \"coupon_code\": \"SUMMERSALE10\",\n \"source\": \"yotpo\",\n \"description\": \"Get $10 off your next order!\",\n \"details\": \"{\\\"amount\\\": 10}\"\n }\n ],\n \"cart\": {\n \"order_reference\": \"order-12345\",\n \"display_id\": \"ID-12345\",\n \"billing_address\": {\n \"id\": \"addres-1\",\n \"street_address1\": \"42 Wallaby Way\",\n \"street_address2\": \"42 Wallaby Way\",\n \"street_address3\": \"42 Wallaby Way\",\n \"street_address4\": \"42 Wallaby Way\",\n \"locality\": \"Wayne County\",\n \"region\": \"Quebec\",\n \"postal_code\": \"11209\",\n \"country_code\": \"US\",\n \"country\": \"Canada\",\n \"name\": \"Charlotte Charles\",\n \"first_name\": \"Charlotte\",\n \"last_name\": \"Charles\",\n \"company\": \"ACME Corp.\",\n \"phone\": \"867-5309\",\n \"email\": \"my.email@gmail.com\"\n },\n \"shipments\": {\n \"shipping_address_id\": \"addres-1\",\n \"shipping_address\": {\n \"id\": \"addres-1\",\n \"street_address1\": \"42 Wallaby Way\",\n \"street_address2\": \"42 Wallaby Way\",\n \"street_address3\": \"42 Wallaby Way\",\n \"street_address4\": \"42 Wallaby Way\",\n \"locality\": \"Wayne County\",\n \"region\": \"Quebec\",\n \"postal_code\": \"11209\",\n \"country_code\": \"US\",\n \"country\": \"Canada\",\n \"name\": \"Charlotte Charles\",\n \"first_name\": \"Charlotte\",\n \"last_name\": \"Charles\",\n \"company\": \"ACME Corp.\",\n \"phone\": \"867-5309\",\n \"email\": \"my.email@gmail.com\"\n },\n \"total_weight\": 55,\n \"shipping_method\": \"Unknown\",\n \"carrier\": \"FedEx\",\n \"service\": \"Option 1\",\n \"expedited\": false,\n \"cost\": 770,\n \"tax_amount\": 230,\n \"package_type\": \"A big package.\",\n \"package_width\": 222,\n \"package_height\": 103,\n \"package_depth\": 90,\n \"package_dimension_unit\": \"cm\",\n \"tax_code\": \"tax-12345\",\n \"estimated_delivery_date\": \"08-30-2022\",\n \"type\": \"A big package.\",\n \"discount_by_membership\": false\n }\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://merchant-url.com/api/cart_update")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"event\": \"cart.update\",\n \"data\": {\n \"order_reference\": \"order-12345\",\n \"add_items\": [\n {\n \"product_id\": \"hat-123\",\n \"price\": 991,\n \"currency\": \"USD\",\n \"quantity\": 3\n }\n ],\n \"remove_items\": [\n {\n \"product_id\": \"hat-123\",\n \"quantity\": 3\n }\n ],\n \"discount_codes_to_add\": [\n \"SUMMERFUN15\"\n ],\n \"discount_codes_to_remove\": [\n \"SUMMERFUN15\"\n ],\n \"gift_cards_to_add\": [\n {\n \"card_number\": \"1111222233334444\",\n \"pin\": 123\n }\n ],\n \"gift_cards_to_remove\": [\n {\n \"card_number\": \"1111222233334444\",\n \"pin\": 123\n }\n ],\n \"loyalty_rewards_to_add\": [\n {\n \"amount\": 1000,\n \"points\": 1000,\n \"type\": \"coupon\",\n \"coupon_code\": \"SUMMERSALE10\",\n \"source\": \"yotpo\",\n \"description\": \"Get $10 off your next order!\",\n \"details\": \"{\\\"amount\\\": 10}\"\n }\n ],\n \"loyalty_rewards_to_remove\": [\n {\n \"amount\": 1000,\n \"points\": 1000,\n \"type\": \"coupon\",\n \"coupon_code\": \"SUMMERSALE10\",\n \"source\": \"yotpo\",\n \"description\": \"Get $10 off your next order!\",\n \"details\": \"{\\\"amount\\\": 10}\"\n }\n ],\n \"cart\": {\n \"order_reference\": \"order-12345\",\n \"display_id\": \"ID-12345\",\n \"billing_address\": {\n \"id\": \"addres-1\",\n \"street_address1\": \"42 Wallaby Way\",\n \"street_address2\": \"42 Wallaby Way\",\n \"street_address3\": \"42 Wallaby Way\",\n \"street_address4\": \"42 Wallaby Way\",\n \"locality\": \"Wayne County\",\n \"region\": \"Quebec\",\n \"postal_code\": \"11209\",\n \"country_code\": \"US\",\n \"country\": \"Canada\",\n \"name\": \"Charlotte Charles\",\n \"first_name\": \"Charlotte\",\n \"last_name\": \"Charles\",\n \"company\": \"ACME Corp.\",\n \"phone\": \"867-5309\",\n \"email\": \"my.email@gmail.com\"\n },\n \"shipments\": {\n \"shipping_address_id\": \"addres-1\",\n \"shipping_address\": {\n \"id\": \"addres-1\",\n \"street_address1\": \"42 Wallaby Way\",\n \"street_address2\": \"42 Wallaby Way\",\n \"street_address3\": \"42 Wallaby Way\",\n \"street_address4\": \"42 Wallaby Way\",\n \"locality\": \"Wayne County\",\n \"region\": \"Quebec\",\n \"postal_code\": \"11209\",\n \"country_code\": \"US\",\n \"country\": \"Canada\",\n \"name\": \"Charlotte Charles\",\n \"first_name\": \"Charlotte\",\n \"last_name\": \"Charles\",\n \"company\": \"ACME Corp.\",\n \"phone\": \"867-5309\",\n \"email\": \"my.email@gmail.com\"\n },\n \"total_weight\": 55,\n \"shipping_method\": \"Unknown\",\n \"carrier\": \"FedEx\",\n \"service\": \"Option 1\",\n \"expedited\": false,\n \"cost\": 770,\n \"tax_amount\": 230,\n \"package_type\": \"A big package.\",\n \"package_width\": 222,\n \"package_height\": 103,\n \"package_depth\": 90,\n \"package_dimension_unit\": \"cm\",\n \"tax_code\": \"tax-12345\",\n \"estimated_delivery_date\": \"08-30-2022\",\n \"type\": \"A big package.\",\n \"discount_by_membership\": false\n }\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"event": "cart.update",
"status": "success",
"data": {
"order_create": {
"cart": {
"currency": "USD",
"total_amount": 9900,
"items": [
{
"reference": "1123",
"name": "Blue Hat",
"total_amount": 9900,
"unit_price": 500,
"quantity": 3,
"description": " Large blue satin hat with initials embroidered.",
"options": "string option",
"tax_amount": {
"amount": 754,
"currency": "USD",
"currency_symbol": "$"
},
"uom": "string",
"upc": "string",
"sku": "SKU-11021",
"isbn": "12-345-678-90123",
"brand": "Bolt Swagstore",
"manufacturer": "Bolt Factory",
"category": "hats",
"collections": [
"summer"
],
"tags": "red",
"color": "Red",
"size": "XXL",
"weight": {
"weight": 22,
"unit": "kg"
},
"image_url": "https://boltswagstore.com/inventory/hats/red-hat.png",
"details_url": "https://boltswagstore.com/inventory/hats/red-hat.png",
"type": "physical",
"taxable": true,
"properties": [
{
"name": "a-name",
"value": "a-value"
}
],
"item_group": "Ships Immediately",
"shipment_type": "unknown",
"customizations": [
{
"name": "Bedazzled",
"price": {
"amount": 754,
"currency": "USD",
"currency_symbol": "$"
},
"attributes": {
"key1": "value1",
"key2": "value2"
}
}
],
"bolt_product_id": "e2bb0e7e-5625-536f-8ad7-25a26537ee28",
"gift_options": {
"wrap": false,
"merchant_product_id": "881",
"message": "Happy Anniversary, Smoochy Poo!",
"cost": 785
}
}
],
"discounts": [
{
"amount": {
"amount": 754,
"currency": "USD",
"currency_symbol": "$"
},
"code": "SUMMERFUN15",
"reference": "SUMMERFUN15",
"description": "Take 15% off of your order.",
"details_url": "https://boltswagstore.com/discounts/#12345",
"free_shipping": {
"is_free_shipping": false,
"maximum_cost_allowed": 100
},
"discount_category": "coupon"
}
],
"order_reference": "order-12345",
"display_id": "ID-12345",
"cart_url": "https://boltswagstore.com/orders/123456765432",
"metadata": [
{
"key1": "value 1"
}
]
}
}
}
}{
"event": "cart.update",
"status": "failure",
"errors": [
{
"code": 2001005,
"data": [
{
"reason": "This product is out of stock."
}
]
}
]
}Authorizations
Admins and Developers can obtain their Bolt API key from the Bolt Merchant Dashboard.
Headers
Bolt sends a signed HMAC for hook verification
Body
application/json