cart.create
curl --request POST \
--url https://merchant-url.com/api/cart_create \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"event": "cart.create",
"data": {
"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",
"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",
"customizations": [
{
"name": "Bedazzled",
"price": {
"amount": 754,
"currency": "USD",
"currency_symbol": "$"
},
"attributes": {
"key1": "value1",
"key2": "value2"
}
}
],
"bolt_product_id": "e2bb0e7e-5625-536f-8ad7-25a26537ee28"
}
],
"currency": "USD",
"metadata": [
{
"key1": "value 1"
}
]
}
}
'import requests
url = "https://merchant-url.com/api/cart_create"
payload = {
"event": "cart.create",
"data": {
"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",
"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",
"customizations": [
{
"name": "Bedazzled",
"price": {
"amount": 754,
"currency": "USD",
"currency_symbol": "$"
},
"attributes": {
"key1": "value1",
"key2": "value2"
}
}
],
"bolt_product_id": "e2bb0e7e-5625-536f-8ad7-25a26537ee28"
}
],
"currency": "USD",
"metadata": [{ "key1": "value 1" }]
}
}
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.create',
data: {
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',
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',
customizations: [
{
name: 'Bedazzled',
price: {amount: 754, currency: 'USD', currency_symbol: '$'},
attributes: {key1: 'value1', key2: 'value2'}
}
],
bolt_product_id: 'e2bb0e7e-5625-536f-8ad7-25a26537ee28'
}
],
currency: 'USD',
metadata: [{key1: 'value 1'}]
}
})
};
fetch('https://merchant-url.com/api/cart_create', 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_create",
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.create',
'data' => [
'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',
'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',
'customizations' => [
[
'name' => 'Bedazzled',
'price' => [
'amount' => 754,
'currency' => 'USD',
'currency_symbol' => '$'
],
'attributes' => [
'key1' => 'value1',
'key2' => 'value2'
]
]
],
'bolt_product_id' => 'e2bb0e7e-5625-536f-8ad7-25a26537ee28'
]
],
'currency' => 'USD',
'metadata' => [
[
'key1' => 'value 1'
]
]
]
]),
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_create"
payload := strings.NewReader("{\n \"event\": \"cart.create\",\n \"data\": {\n \"items\": [\n {\n \"reference\": \"1123\",\n \"name\": \"Blue Hat\",\n \"total_amount\": 9900,\n \"unit_price\": 500,\n \"quantity\": 3,\n \"description\": \" Large blue satin hat with initials embroidered.\",\n \"options\": \"string option\",\n \"uom\": \"string\",\n \"upc\": \"string\",\n \"sku\": \"SKU-11021\",\n \"isbn\": \"12-345-678-90123\",\n \"brand\": \"Bolt Swagstore\",\n \"manufacturer\": \"Bolt Factory\",\n \"category\": \"hats\",\n \"collections\": [\n \"summer\"\n ],\n \"tags\": \"red\",\n \"color\": \"Red\",\n \"size\": \"XXL\",\n \"weight\": {\n \"weight\": 22,\n \"unit\": \"kg\"\n },\n \"image_url\": \"https://boltswagstore.com/inventory/hats/red-hat.png\",\n \"details_url\": \"https://boltswagstore.com/inventory/hats/red-hat.png\",\n \"type\": \"physical\",\n \"taxable\": true,\n \"properties\": [\n {\n \"name\": \"a-name\",\n \"value\": \"a-value\"\n }\n ],\n \"item_group\": \"Ships Immediately\",\n \"customizations\": [\n {\n \"name\": \"Bedazzled\",\n \"price\": {\n \"amount\": 754,\n \"currency\": \"USD\",\n \"currency_symbol\": \"$\"\n },\n \"attributes\": {\n \"key1\": \"value1\",\n \"key2\": \"value2\"\n }\n }\n ],\n \"bolt_product_id\": \"e2bb0e7e-5625-536f-8ad7-25a26537ee28\"\n }\n ],\n \"currency\": \"USD\",\n \"metadata\": [\n {\n \"key1\": \"value 1\"\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_create")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"event\": \"cart.create\",\n \"data\": {\n \"items\": [\n {\n \"reference\": \"1123\",\n \"name\": \"Blue Hat\",\n \"total_amount\": 9900,\n \"unit_price\": 500,\n \"quantity\": 3,\n \"description\": \" Large blue satin hat with initials embroidered.\",\n \"options\": \"string option\",\n \"uom\": \"string\",\n \"upc\": \"string\",\n \"sku\": \"SKU-11021\",\n \"isbn\": \"12-345-678-90123\",\n \"brand\": \"Bolt Swagstore\",\n \"manufacturer\": \"Bolt Factory\",\n \"category\": \"hats\",\n \"collections\": [\n \"summer\"\n ],\n \"tags\": \"red\",\n \"color\": \"Red\",\n \"size\": \"XXL\",\n \"weight\": {\n \"weight\": 22,\n \"unit\": \"kg\"\n },\n \"image_url\": \"https://boltswagstore.com/inventory/hats/red-hat.png\",\n \"details_url\": \"https://boltswagstore.com/inventory/hats/red-hat.png\",\n \"type\": \"physical\",\n \"taxable\": true,\n \"properties\": [\n {\n \"name\": \"a-name\",\n \"value\": \"a-value\"\n }\n ],\n \"item_group\": \"Ships Immediately\",\n \"customizations\": [\n {\n \"name\": \"Bedazzled\",\n \"price\": {\n \"amount\": 754,\n \"currency\": \"USD\",\n \"currency_symbol\": \"$\"\n },\n \"attributes\": {\n \"key1\": \"value1\",\n \"key2\": \"value2\"\n }\n }\n ],\n \"bolt_product_id\": \"e2bb0e7e-5625-536f-8ad7-25a26537ee28\"\n }\n ],\n \"currency\": \"USD\",\n \"metadata\": [\n {\n \"key1\": \"value 1\"\n }\n ]\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://merchant-url.com/api/cart_create")
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.create\",\n \"data\": {\n \"items\": [\n {\n \"reference\": \"1123\",\n \"name\": \"Blue Hat\",\n \"total_amount\": 9900,\n \"unit_price\": 500,\n \"quantity\": 3,\n \"description\": \" Large blue satin hat with initials embroidered.\",\n \"options\": \"string option\",\n \"uom\": \"string\",\n \"upc\": \"string\",\n \"sku\": \"SKU-11021\",\n \"isbn\": \"12-345-678-90123\",\n \"brand\": \"Bolt Swagstore\",\n \"manufacturer\": \"Bolt Factory\",\n \"category\": \"hats\",\n \"collections\": [\n \"summer\"\n ],\n \"tags\": \"red\",\n \"color\": \"Red\",\n \"size\": \"XXL\",\n \"weight\": {\n \"weight\": 22,\n \"unit\": \"kg\"\n },\n \"image_url\": \"https://boltswagstore.com/inventory/hats/red-hat.png\",\n \"details_url\": \"https://boltswagstore.com/inventory/hats/red-hat.png\",\n \"type\": \"physical\",\n \"taxable\": true,\n \"properties\": [\n {\n \"name\": \"a-name\",\n \"value\": \"a-value\"\n }\n ],\n \"item_group\": \"Ships Immediately\",\n \"customizations\": [\n {\n \"name\": \"Bedazzled\",\n \"price\": {\n \"amount\": 754,\n \"currency\": \"USD\",\n \"currency_symbol\": \"$\"\n },\n \"attributes\": {\n \"key1\": \"value1\",\n \"key2\": \"value2\"\n }\n }\n ],\n \"bolt_product_id\": \"e2bb0e7e-5625-536f-8ad7-25a26537ee28\"\n }\n ],\n \"currency\": \"USD\",\n \"metadata\": [\n {\n \"key1\": \"value 1\"\n }\n ]\n }\n}"
response = http.request(request)
puts response.read_body{
"event": "cart.create",
"status": "success",
"data": {
"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.create",
"status": "failure",
"error": {
"code": 2001005,
"data": [
{
"reason": "This product is out of stock."
}
]
}
}Cart
cart.create
This is only used for Product-Page Checkout to create a cart filled with items.
POST
/
cart_create
cart.create
curl --request POST \
--url https://merchant-url.com/api/cart_create \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"event": "cart.create",
"data": {
"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",
"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",
"customizations": [
{
"name": "Bedazzled",
"price": {
"amount": 754,
"currency": "USD",
"currency_symbol": "$"
},
"attributes": {
"key1": "value1",
"key2": "value2"
}
}
],
"bolt_product_id": "e2bb0e7e-5625-536f-8ad7-25a26537ee28"
}
],
"currency": "USD",
"metadata": [
{
"key1": "value 1"
}
]
}
}
'import requests
url = "https://merchant-url.com/api/cart_create"
payload = {
"event": "cart.create",
"data": {
"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",
"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",
"customizations": [
{
"name": "Bedazzled",
"price": {
"amount": 754,
"currency": "USD",
"currency_symbol": "$"
},
"attributes": {
"key1": "value1",
"key2": "value2"
}
}
],
"bolt_product_id": "e2bb0e7e-5625-536f-8ad7-25a26537ee28"
}
],
"currency": "USD",
"metadata": [{ "key1": "value 1" }]
}
}
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.create',
data: {
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',
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',
customizations: [
{
name: 'Bedazzled',
price: {amount: 754, currency: 'USD', currency_symbol: '$'},
attributes: {key1: 'value1', key2: 'value2'}
}
],
bolt_product_id: 'e2bb0e7e-5625-536f-8ad7-25a26537ee28'
}
],
currency: 'USD',
metadata: [{key1: 'value 1'}]
}
})
};
fetch('https://merchant-url.com/api/cart_create', 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_create",
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.create',
'data' => [
'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',
'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',
'customizations' => [
[
'name' => 'Bedazzled',
'price' => [
'amount' => 754,
'currency' => 'USD',
'currency_symbol' => '$'
],
'attributes' => [
'key1' => 'value1',
'key2' => 'value2'
]
]
],
'bolt_product_id' => 'e2bb0e7e-5625-536f-8ad7-25a26537ee28'
]
],
'currency' => 'USD',
'metadata' => [
[
'key1' => 'value 1'
]
]
]
]),
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_create"
payload := strings.NewReader("{\n \"event\": \"cart.create\",\n \"data\": {\n \"items\": [\n {\n \"reference\": \"1123\",\n \"name\": \"Blue Hat\",\n \"total_amount\": 9900,\n \"unit_price\": 500,\n \"quantity\": 3,\n \"description\": \" Large blue satin hat with initials embroidered.\",\n \"options\": \"string option\",\n \"uom\": \"string\",\n \"upc\": \"string\",\n \"sku\": \"SKU-11021\",\n \"isbn\": \"12-345-678-90123\",\n \"brand\": \"Bolt Swagstore\",\n \"manufacturer\": \"Bolt Factory\",\n \"category\": \"hats\",\n \"collections\": [\n \"summer\"\n ],\n \"tags\": \"red\",\n \"color\": \"Red\",\n \"size\": \"XXL\",\n \"weight\": {\n \"weight\": 22,\n \"unit\": \"kg\"\n },\n \"image_url\": \"https://boltswagstore.com/inventory/hats/red-hat.png\",\n \"details_url\": \"https://boltswagstore.com/inventory/hats/red-hat.png\",\n \"type\": \"physical\",\n \"taxable\": true,\n \"properties\": [\n {\n \"name\": \"a-name\",\n \"value\": \"a-value\"\n }\n ],\n \"item_group\": \"Ships Immediately\",\n \"customizations\": [\n {\n \"name\": \"Bedazzled\",\n \"price\": {\n \"amount\": 754,\n \"currency\": \"USD\",\n \"currency_symbol\": \"$\"\n },\n \"attributes\": {\n \"key1\": \"value1\",\n \"key2\": \"value2\"\n }\n }\n ],\n \"bolt_product_id\": \"e2bb0e7e-5625-536f-8ad7-25a26537ee28\"\n }\n ],\n \"currency\": \"USD\",\n \"metadata\": [\n {\n \"key1\": \"value 1\"\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_create")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"event\": \"cart.create\",\n \"data\": {\n \"items\": [\n {\n \"reference\": \"1123\",\n \"name\": \"Blue Hat\",\n \"total_amount\": 9900,\n \"unit_price\": 500,\n \"quantity\": 3,\n \"description\": \" Large blue satin hat with initials embroidered.\",\n \"options\": \"string option\",\n \"uom\": \"string\",\n \"upc\": \"string\",\n \"sku\": \"SKU-11021\",\n \"isbn\": \"12-345-678-90123\",\n \"brand\": \"Bolt Swagstore\",\n \"manufacturer\": \"Bolt Factory\",\n \"category\": \"hats\",\n \"collections\": [\n \"summer\"\n ],\n \"tags\": \"red\",\n \"color\": \"Red\",\n \"size\": \"XXL\",\n \"weight\": {\n \"weight\": 22,\n \"unit\": \"kg\"\n },\n \"image_url\": \"https://boltswagstore.com/inventory/hats/red-hat.png\",\n \"details_url\": \"https://boltswagstore.com/inventory/hats/red-hat.png\",\n \"type\": \"physical\",\n \"taxable\": true,\n \"properties\": [\n {\n \"name\": \"a-name\",\n \"value\": \"a-value\"\n }\n ],\n \"item_group\": \"Ships Immediately\",\n \"customizations\": [\n {\n \"name\": \"Bedazzled\",\n \"price\": {\n \"amount\": 754,\n \"currency\": \"USD\",\n \"currency_symbol\": \"$\"\n },\n \"attributes\": {\n \"key1\": \"value1\",\n \"key2\": \"value2\"\n }\n }\n ],\n \"bolt_product_id\": \"e2bb0e7e-5625-536f-8ad7-25a26537ee28\"\n }\n ],\n \"currency\": \"USD\",\n \"metadata\": [\n {\n \"key1\": \"value 1\"\n }\n ]\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://merchant-url.com/api/cart_create")
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.create\",\n \"data\": {\n \"items\": [\n {\n \"reference\": \"1123\",\n \"name\": \"Blue Hat\",\n \"total_amount\": 9900,\n \"unit_price\": 500,\n \"quantity\": 3,\n \"description\": \" Large blue satin hat with initials embroidered.\",\n \"options\": \"string option\",\n \"uom\": \"string\",\n \"upc\": \"string\",\n \"sku\": \"SKU-11021\",\n \"isbn\": \"12-345-678-90123\",\n \"brand\": \"Bolt Swagstore\",\n \"manufacturer\": \"Bolt Factory\",\n \"category\": \"hats\",\n \"collections\": [\n \"summer\"\n ],\n \"tags\": \"red\",\n \"color\": \"Red\",\n \"size\": \"XXL\",\n \"weight\": {\n \"weight\": 22,\n \"unit\": \"kg\"\n },\n \"image_url\": \"https://boltswagstore.com/inventory/hats/red-hat.png\",\n \"details_url\": \"https://boltswagstore.com/inventory/hats/red-hat.png\",\n \"type\": \"physical\",\n \"taxable\": true,\n \"properties\": [\n {\n \"name\": \"a-name\",\n \"value\": \"a-value\"\n }\n ],\n \"item_group\": \"Ships Immediately\",\n \"customizations\": [\n {\n \"name\": \"Bedazzled\",\n \"price\": {\n \"amount\": 754,\n \"currency\": \"USD\",\n \"currency_symbol\": \"$\"\n },\n \"attributes\": {\n \"key1\": \"value1\",\n \"key2\": \"value2\"\n }\n }\n ],\n \"bolt_product_id\": \"e2bb0e7e-5625-536f-8ad7-25a26537ee28\"\n }\n ],\n \"currency\": \"USD\",\n \"metadata\": [\n {\n \"key1\": \"value 1\"\n }\n ]\n }\n}"
response = http.request(request)
puts response.read_body{
"event": "cart.create",
"status": "success",
"data": {
"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.create",
"status": "failure",
"error": {
"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