List Upsells
curl --request POST \
--url https://api.centralcart.io/v1/webstore/upsells \
--header 'Content-Type: application/json' \
--header 'x-store-domain: <x-store-domain>' \
--data '
{
"cart": [
1,
3
],
"placement": "CHECKOUT"
}
'import requests
url = "https://api.centralcart.io/v1/webstore/upsells"
payload = {
"cart": [1, 3],
"placement": "CHECKOUT"
}
headers = {
"x-store-domain": "<x-store-domain>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-store-domain': '<x-store-domain>', 'Content-Type': 'application/json'},
body: JSON.stringify({cart: [1, 3], placement: 'CHECKOUT'})
};
fetch('https://api.centralcart.io/v1/webstore/upsells', 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.centralcart.io/v1/webstore/upsells",
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([
'cart' => [
1,
3
],
'placement' => 'CHECKOUT'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-store-domain: <x-store-domain>"
],
]);
$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.centralcart.io/v1/webstore/upsells"
payload := strings.NewReader("{\n \"cart\": [\n 1,\n 3\n ],\n \"placement\": \"CHECKOUT\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-store-domain", "<x-store-domain>")
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.centralcart.io/v1/webstore/upsells")
.header("x-store-domain", "<x-store-domain>")
.header("Content-Type", "application/json")
.body("{\n \"cart\": [\n 1,\n 3\n ],\n \"placement\": \"CHECKOUT\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.centralcart.io/v1/webstore/upsells")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-store-domain"] = '<x-store-domain>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"cart\": [\n 1,\n 3\n ],\n \"placement\": \"CHECKOUT\"\n}"
response = http.request(request)
puts response.read_body[
{
"id": 7,
"name": "Chave Bônus",
"slug": "chave-bonus",
"pricing": {
"price": 5,
"compare_at": 15
},
"upsell": {
"type": "ADDITIONAL",
"source": "product",
"upsell_trigger_id": 1,
"offer_price": 5,
"original_price": 15,
"has_discount": true,
"in_cart": false
}
}
]{
"errors": [
{
"message": "Store not found."
}
]
}Checkout
List Upsells
Devolve as ofertas de upsell aplicáveis ao carrinho atual.
Use
placement: "CHECKOUT" na etapa de pagamento e placement: "POST_SALE" na página de obrigado. As regras casam por produto gatilho presente no carrinho, por regra global, ou pelos produtos mais vendidos da loja, que só valem no checkout. Produtos sem estoque saem da resposta. Um mesmo produto pode aparecer mais de uma vez quando a regra é do tipo ALTERNATIVE e há vários gatilhos no carrinho; cada entrada traz o seu upsell.upsell_trigger_id.POST
/
webstore
/
upsells
List Upsells
curl --request POST \
--url https://api.centralcart.io/v1/webstore/upsells \
--header 'Content-Type: application/json' \
--header 'x-store-domain: <x-store-domain>' \
--data '
{
"cart": [
1,
3
],
"placement": "CHECKOUT"
}
'import requests
url = "https://api.centralcart.io/v1/webstore/upsells"
payload = {
"cart": [1, 3],
"placement": "CHECKOUT"
}
headers = {
"x-store-domain": "<x-store-domain>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-store-domain': '<x-store-domain>', 'Content-Type': 'application/json'},
body: JSON.stringify({cart: [1, 3], placement: 'CHECKOUT'})
};
fetch('https://api.centralcart.io/v1/webstore/upsells', 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.centralcart.io/v1/webstore/upsells",
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([
'cart' => [
1,
3
],
'placement' => 'CHECKOUT'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-store-domain: <x-store-domain>"
],
]);
$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.centralcart.io/v1/webstore/upsells"
payload := strings.NewReader("{\n \"cart\": [\n 1,\n 3\n ],\n \"placement\": \"CHECKOUT\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-store-domain", "<x-store-domain>")
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.centralcart.io/v1/webstore/upsells")
.header("x-store-domain", "<x-store-domain>")
.header("Content-Type", "application/json")
.body("{\n \"cart\": [\n 1,\n 3\n ],\n \"placement\": \"CHECKOUT\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.centralcart.io/v1/webstore/upsells")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-store-domain"] = '<x-store-domain>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"cart\": [\n 1,\n 3\n ],\n \"placement\": \"CHECKOUT\"\n}"
response = http.request(request)
puts response.read_body[
{
"id": 7,
"name": "Chave Bônus",
"slug": "chave-bonus",
"pricing": {
"price": 5,
"compare_at": 15
},
"upsell": {
"type": "ADDITIONAL",
"source": "product",
"upsell_trigger_id": 1,
"offer_price": 5,
"original_price": 15,
"has_discount": true,
"in_cart": false
}
}
]{
"errors": [
{
"message": "Store not found."
}
]
}Cabeçalhos
Domínio da sua loja (ex: sualoja.centralcart.ai)
Corpo
application/json
⌘I