curl --request PUT \
--url {protocol}://{host}/wp-json/cocart/preview/checkout \
--header 'Content-Type: application/json' \
--data '
{
"billing_address": {
"first_name": "<string>",
"last_name": "<string>",
"company": "<string>",
"address_1": "<string>",
"address_2": "<string>",
"city": "<string>",
"state": "<string>",
"postcode": "<string>",
"country": "<string>",
"phone": "<string>",
"email": "jsmith@example.com"
},
"shipping_address": {
"first_name": "<string>",
"last_name": "<string>",
"company": "<string>",
"address_1": "<string>",
"address_2": "<string>",
"city": "<string>",
"state": "<string>",
"postcode": "<string>",
"country": "<string>"
},
"payment_method": "<string>",
"shipping_method": "<string>",
"currency": "EUR"
}
'import requests
url = "{protocol}://{host}/wp-json/cocart/preview/checkout"
payload = {
"billing_address": {
"first_name": "<string>",
"last_name": "<string>",
"company": "<string>",
"address_1": "<string>",
"address_2": "<string>",
"city": "<string>",
"state": "<string>",
"postcode": "<string>",
"country": "<string>",
"phone": "<string>",
"email": "jsmith@example.com"
},
"shipping_address": {
"first_name": "<string>",
"last_name": "<string>",
"company": "<string>",
"address_1": "<string>",
"address_2": "<string>",
"city": "<string>",
"state": "<string>",
"postcode": "<string>",
"country": "<string>"
},
"payment_method": "<string>",
"shipping_method": "<string>",
"currency": "EUR"
}
headers = {"Content-Type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
billing_address: {
first_name: '<string>',
last_name: '<string>',
company: '<string>',
address_1: '<string>',
address_2: '<string>',
city: '<string>',
state: '<string>',
postcode: '<string>',
country: '<string>',
phone: '<string>',
email: 'jsmith@example.com'
},
shipping_address: {
first_name: '<string>',
last_name: '<string>',
company: '<string>',
address_1: '<string>',
address_2: '<string>',
city: '<string>',
state: '<string>',
postcode: '<string>',
country: '<string>'
},
payment_method: '<string>',
shipping_method: '<string>',
currency: 'EUR'
})
};
fetch('{protocol}://{host}/wp-json/cocart/preview/checkout', 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 => "{protocol}://{host}/wp-json/cocart/preview/checkout",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'billing_address' => [
'first_name' => '<string>',
'last_name' => '<string>',
'company' => '<string>',
'address_1' => '<string>',
'address_2' => '<string>',
'city' => '<string>',
'state' => '<string>',
'postcode' => '<string>',
'country' => '<string>',
'phone' => '<string>',
'email' => 'jsmith@example.com'
],
'shipping_address' => [
'first_name' => '<string>',
'last_name' => '<string>',
'company' => '<string>',
'address_1' => '<string>',
'address_2' => '<string>',
'city' => '<string>',
'state' => '<string>',
'postcode' => '<string>',
'country' => '<string>'
],
'payment_method' => '<string>',
'shipping_method' => '<string>',
'currency' => 'EUR'
]),
CURLOPT_HTTPHEADER => [
"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 := "{protocol}://{host}/wp-json/cocart/preview/checkout"
payload := strings.NewReader("{\n \"billing_address\": {\n \"first_name\": \"<string>\",\n \"last_name\": \"<string>\",\n \"company\": \"<string>\",\n \"address_1\": \"<string>\",\n \"address_2\": \"<string>\",\n \"city\": \"<string>\",\n \"state\": \"<string>\",\n \"postcode\": \"<string>\",\n \"country\": \"<string>\",\n \"phone\": \"<string>\",\n \"email\": \"jsmith@example.com\"\n },\n \"shipping_address\": {\n \"first_name\": \"<string>\",\n \"last_name\": \"<string>\",\n \"company\": \"<string>\",\n \"address_1\": \"<string>\",\n \"address_2\": \"<string>\",\n \"city\": \"<string>\",\n \"state\": \"<string>\",\n \"postcode\": \"<string>\",\n \"country\": \"<string>\"\n },\n \"payment_method\": \"<string>\",\n \"shipping_method\": \"<string>\",\n \"currency\": \"EUR\"\n}")
req, _ := http.NewRequest("PUT", url, payload)
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.put("{protocol}://{host}/wp-json/cocart/preview/checkout")
.header("Content-Type", "application/json")
.body("{\n \"billing_address\": {\n \"first_name\": \"<string>\",\n \"last_name\": \"<string>\",\n \"company\": \"<string>\",\n \"address_1\": \"<string>\",\n \"address_2\": \"<string>\",\n \"city\": \"<string>\",\n \"state\": \"<string>\",\n \"postcode\": \"<string>\",\n \"country\": \"<string>\",\n \"phone\": \"<string>\",\n \"email\": \"jsmith@example.com\"\n },\n \"shipping_address\": {\n \"first_name\": \"<string>\",\n \"last_name\": \"<string>\",\n \"company\": \"<string>\",\n \"address_1\": \"<string>\",\n \"address_2\": \"<string>\",\n \"city\": \"<string>\",\n \"state\": \"<string>\",\n \"postcode\": \"<string>\",\n \"country\": \"<string>\"\n },\n \"payment_method\": \"<string>\",\n \"shipping_method\": \"<string>\",\n \"currency\": \"EUR\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("{protocol}://{host}/wp-json/cocart/preview/checkout")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Put.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"billing_address\": {\n \"first_name\": \"<string>\",\n \"last_name\": \"<string>\",\n \"company\": \"<string>\",\n \"address_1\": \"<string>\",\n \"address_2\": \"<string>\",\n \"city\": \"<string>\",\n \"state\": \"<string>\",\n \"postcode\": \"<string>\",\n \"country\": \"<string>\",\n \"phone\": \"<string>\",\n \"email\": \"jsmith@example.com\"\n },\n \"shipping_address\": {\n \"first_name\": \"<string>\",\n \"last_name\": \"<string>\",\n \"company\": \"<string>\",\n \"address_1\": \"<string>\",\n \"address_2\": \"<string>\",\n \"city\": \"<string>\",\n \"state\": \"<string>\",\n \"postcode\": \"<string>\",\n \"country\": \"<string>\"\n },\n \"payment_method\": \"<string>\",\n \"shipping_method\": \"<string>\",\n \"currency\": \"EUR\"\n}"
response = http.request(request)
puts response.read_bodyUpdate checkout information such as billing/shipping addresses, payment method, or shipping method
curl --request PUT \
--url {protocol}://{host}/wp-json/cocart/preview/checkout \
--header 'Content-Type: application/json' \
--data '
{
"billing_address": {
"first_name": "<string>",
"last_name": "<string>",
"company": "<string>",
"address_1": "<string>",
"address_2": "<string>",
"city": "<string>",
"state": "<string>",
"postcode": "<string>",
"country": "<string>",
"phone": "<string>",
"email": "jsmith@example.com"
},
"shipping_address": {
"first_name": "<string>",
"last_name": "<string>",
"company": "<string>",
"address_1": "<string>",
"address_2": "<string>",
"city": "<string>",
"state": "<string>",
"postcode": "<string>",
"country": "<string>"
},
"payment_method": "<string>",
"shipping_method": "<string>",
"currency": "EUR"
}
'import requests
url = "{protocol}://{host}/wp-json/cocart/preview/checkout"
payload = {
"billing_address": {
"first_name": "<string>",
"last_name": "<string>",
"company": "<string>",
"address_1": "<string>",
"address_2": "<string>",
"city": "<string>",
"state": "<string>",
"postcode": "<string>",
"country": "<string>",
"phone": "<string>",
"email": "jsmith@example.com"
},
"shipping_address": {
"first_name": "<string>",
"last_name": "<string>",
"company": "<string>",
"address_1": "<string>",
"address_2": "<string>",
"city": "<string>",
"state": "<string>",
"postcode": "<string>",
"country": "<string>"
},
"payment_method": "<string>",
"shipping_method": "<string>",
"currency": "EUR"
}
headers = {"Content-Type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
billing_address: {
first_name: '<string>',
last_name: '<string>',
company: '<string>',
address_1: '<string>',
address_2: '<string>',
city: '<string>',
state: '<string>',
postcode: '<string>',
country: '<string>',
phone: '<string>',
email: 'jsmith@example.com'
},
shipping_address: {
first_name: '<string>',
last_name: '<string>',
company: '<string>',
address_1: '<string>',
address_2: '<string>',
city: '<string>',
state: '<string>',
postcode: '<string>',
country: '<string>'
},
payment_method: '<string>',
shipping_method: '<string>',
currency: 'EUR'
})
};
fetch('{protocol}://{host}/wp-json/cocart/preview/checkout', 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 => "{protocol}://{host}/wp-json/cocart/preview/checkout",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'billing_address' => [
'first_name' => '<string>',
'last_name' => '<string>',
'company' => '<string>',
'address_1' => '<string>',
'address_2' => '<string>',
'city' => '<string>',
'state' => '<string>',
'postcode' => '<string>',
'country' => '<string>',
'phone' => '<string>',
'email' => 'jsmith@example.com'
],
'shipping_address' => [
'first_name' => '<string>',
'last_name' => '<string>',
'company' => '<string>',
'address_1' => '<string>',
'address_2' => '<string>',
'city' => '<string>',
'state' => '<string>',
'postcode' => '<string>',
'country' => '<string>'
],
'payment_method' => '<string>',
'shipping_method' => '<string>',
'currency' => 'EUR'
]),
CURLOPT_HTTPHEADER => [
"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 := "{protocol}://{host}/wp-json/cocart/preview/checkout"
payload := strings.NewReader("{\n \"billing_address\": {\n \"first_name\": \"<string>\",\n \"last_name\": \"<string>\",\n \"company\": \"<string>\",\n \"address_1\": \"<string>\",\n \"address_2\": \"<string>\",\n \"city\": \"<string>\",\n \"state\": \"<string>\",\n \"postcode\": \"<string>\",\n \"country\": \"<string>\",\n \"phone\": \"<string>\",\n \"email\": \"jsmith@example.com\"\n },\n \"shipping_address\": {\n \"first_name\": \"<string>\",\n \"last_name\": \"<string>\",\n \"company\": \"<string>\",\n \"address_1\": \"<string>\",\n \"address_2\": \"<string>\",\n \"city\": \"<string>\",\n \"state\": \"<string>\",\n \"postcode\": \"<string>\",\n \"country\": \"<string>\"\n },\n \"payment_method\": \"<string>\",\n \"shipping_method\": \"<string>\",\n \"currency\": \"EUR\"\n}")
req, _ := http.NewRequest("PUT", url, payload)
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.put("{protocol}://{host}/wp-json/cocart/preview/checkout")
.header("Content-Type", "application/json")
.body("{\n \"billing_address\": {\n \"first_name\": \"<string>\",\n \"last_name\": \"<string>\",\n \"company\": \"<string>\",\n \"address_1\": \"<string>\",\n \"address_2\": \"<string>\",\n \"city\": \"<string>\",\n \"state\": \"<string>\",\n \"postcode\": \"<string>\",\n \"country\": \"<string>\",\n \"phone\": \"<string>\",\n \"email\": \"jsmith@example.com\"\n },\n \"shipping_address\": {\n \"first_name\": \"<string>\",\n \"last_name\": \"<string>\",\n \"company\": \"<string>\",\n \"address_1\": \"<string>\",\n \"address_2\": \"<string>\",\n \"city\": \"<string>\",\n \"state\": \"<string>\",\n \"postcode\": \"<string>\",\n \"country\": \"<string>\"\n },\n \"payment_method\": \"<string>\",\n \"shipping_method\": \"<string>\",\n \"currency\": \"EUR\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("{protocol}://{host}/wp-json/cocart/preview/checkout")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Put.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"billing_address\": {\n \"first_name\": \"<string>\",\n \"last_name\": \"<string>\",\n \"company\": \"<string>\",\n \"address_1\": \"<string>\",\n \"address_2\": \"<string>\",\n \"city\": \"<string>\",\n \"state\": \"<string>\",\n \"postcode\": \"<string>\",\n \"country\": \"<string>\",\n \"phone\": \"<string>\",\n \"email\": \"jsmith@example.com\"\n },\n \"shipping_address\": {\n \"first_name\": \"<string>\",\n \"last_name\": \"<string>\",\n \"company\": \"<string>\",\n \"address_1\": \"<string>\",\n \"address_2\": \"<string>\",\n \"city\": \"<string>\",\n \"state\": \"<string>\",\n \"postcode\": \"<string>\",\n \"country\": \"<string>\"\n },\n \"payment_method\": \"<string>\",\n \"shipping_method\": \"<string>\",\n \"currency\": \"EUR\"\n}"
response = http.request(request)
puts response.read_bodyOverview
This endpoint updates checkout information such as billing/shipping addresses, payment method, or shipping method. Both PUT and PATCH methods are supported and function identically.Body
Checkout data to update
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Payment method ID
Shipping method ID
Currency code for the order (e.g., USD, EUR, GBP). If not provided, store default will be used.
^[A-Z]{3}$"EUR"
Response
Checkout data updated successfully
Unique identifier for the cart session
MD5 hash of cart contents
Currency information including code, symbol, and exchange rate
Show child attributes
Show child attributes
Customer ID, if logged in
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Cart contents with product details
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Available shipping methods
Show child attributes
Show child attributes
Whether the cart needs payment
Whether the cart needs shipping
Selected payment method
Was this page helpful?