Switch Cart Market
curl --request POST \
--url https://api.marzipan.co/v1/carts/{cartId}/market \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"marketId": "0c9a1b2d-3e4f-5061-7283-94a5b6c7d8e9"
}
'import requests
url = "https://api.marzipan.co/v1/carts/{cartId}/market"
payload = { "marketId": "0c9a1b2d-3e4f-5061-7283-94a5b6c7d8e9" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({marketId: '0c9a1b2d-3e4f-5061-7283-94a5b6c7d8e9'})
};
fetch('https://api.marzipan.co/v1/carts/{cartId}/market', 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://api.marzipan.co/v1/carts/{cartId}/market",
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([
'marketId' => '0c9a1b2d-3e4f-5061-7283-94a5b6c7d8e9'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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://api.marzipan.co/v1/carts/{cartId}/market"
payload := strings.NewReader("{\n \"marketId\": \"0c9a1b2d-3e4f-5061-7283-94a5b6c7d8e9\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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://api.marzipan.co/v1/carts/{cartId}/market")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"marketId\": \"0c9a1b2d-3e4f-5061-7283-94a5b6c7d8e9\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.marzipan.co/v1/carts/{cartId}/market")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"marketId\": \"0c9a1b2d-3e4f-5061-7283-94a5b6c7d8e9\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "893ff86d-4453-4134-9f62-5c9b7a70d74e",
"cartCount": 2,
"subTotal": 5600,
"shipping": 0,
"tax": 0,
"grandTotal": 5600,
"currency": {
"code": "USD",
"symbol": "$"
},
"market": {
"id": "0c9a1b2d-3e4f-5061-7283-94a5b6c7d8e9",
"name": "United States",
"currencyCode": "USD",
"currencySymbol": "$"
}
}
}{
"message": "Market not found or not available."
}{
"message": "Market ID is required."
}Carts
Switch Cart Market
Change the cart’s market, updating its currency and exchange rate. Shipping is cleared and every line item is repriced in the new market’s currency. Returns the recalculated cart.
POST
/
carts
/
{cartId}
/
market
Switch Cart Market
curl --request POST \
--url https://api.marzipan.co/v1/carts/{cartId}/market \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"marketId": "0c9a1b2d-3e4f-5061-7283-94a5b6c7d8e9"
}
'import requests
url = "https://api.marzipan.co/v1/carts/{cartId}/market"
payload = { "marketId": "0c9a1b2d-3e4f-5061-7283-94a5b6c7d8e9" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({marketId: '0c9a1b2d-3e4f-5061-7283-94a5b6c7d8e9'})
};
fetch('https://api.marzipan.co/v1/carts/{cartId}/market', 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://api.marzipan.co/v1/carts/{cartId}/market",
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([
'marketId' => '0c9a1b2d-3e4f-5061-7283-94a5b6c7d8e9'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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://api.marzipan.co/v1/carts/{cartId}/market"
payload := strings.NewReader("{\n \"marketId\": \"0c9a1b2d-3e4f-5061-7283-94a5b6c7d8e9\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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://api.marzipan.co/v1/carts/{cartId}/market")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"marketId\": \"0c9a1b2d-3e4f-5061-7283-94a5b6c7d8e9\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.marzipan.co/v1/carts/{cartId}/market")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"marketId\": \"0c9a1b2d-3e4f-5061-7283-94a5b6c7d8e9\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "893ff86d-4453-4134-9f62-5c9b7a70d74e",
"cartCount": 2,
"subTotal": 5600,
"shipping": 0,
"tax": 0,
"grandTotal": 5600,
"currency": {
"code": "USD",
"symbol": "$"
},
"market": {
"id": "0c9a1b2d-3e4f-5061-7283-94a5b6c7d8e9",
"name": "United States",
"currencyCode": "USD",
"currencySymbol": "$"
}
}
}{
"message": "Market not found or not available."
}{
"message": "Market ID is required."
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your API token.
Path Parameters
The unique identifier for the cart
Body
application/json
The identifier of the market to switch the cart to.
Response
Market switched. Returns the recalculated cart in the new market's currency.
A storefront shopping cart with its items, totals and applied discounts. Monetary amounts are expressed in the cart currency's minor units (e.g. pence/cents).
Show child attributes
Show child attributes
⌘I

