Get order received details
curl --request GET \
--url {protocol}://{host}/wp-json/cocart/preview/order-received/{order_id} \
--header 'Authorization: Basic <encoded-value>'import requests
url = "{protocol}://{host}/wp-json/cocart/preview/order-received/{order_id}"
headers = {"Authorization": "Basic <encoded-value>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Basic <encoded-value>'}};
fetch('{protocol}://{host}/wp-json/cocart/preview/order-received/{order_id}', 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/order-received/{order_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{protocol}://{host}/wp-json/cocart/preview/order-received/{order_id}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Basic <encoded-value>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("{protocol}://{host}/wp-json/cocart/preview/order-received/{order_id}")
.header("Authorization", "Basic <encoded-value>")
.asString();require 'uri'
require 'net/http'
url = URI("{protocol}://{host}/wp-json/cocart/preview/order-received/{order_id}")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Basic <encoded-value>'
response = http.request(request)
puts response.read_body{
"order_id": 789,
"order_number": "789",
"order_key": "wc_order_abc123xyz",
"status": "processing",
"status_name": "Processing",
"date_created": "December 15, 2024, 2:20 pm",
"date_paid": "December 15, 2024, 2:21 pm",
"currency": "USD",
"total": "44.98",
"subtotal": "39.98",
"tax_total": "0.00",
"shipping_total": "5.00",
"discount_total": "0.00",
"payment_method": "stripe",
"payment_method_title": "Credit Card (Stripe)",
"customer_id": 123,
"customer_note": "Please leave at the door",
"billing_address": {
"first_name": "John",
"last_name": "Doe",
"email": "john@example.com",
"phone": "+1234567890",
"address_1": "123 Main St",
"address_2": "Apt 4B",
"city": "Anytown",
"state": "CA",
"postcode": "12345",
"country": "US",
"company": ""
},
"shipping_address": {
"first_name": "John",
"last_name": "Doe",
"address_1": "123 Main St",
"address_2": "Apt 4B",
"city": "Anytown",
"state": "CA",
"postcode": "12345",
"country": "US",
"company": ""
},
"items": [
{
"item_id": 1,
"product_id": 456,
"variation_id": 0,
"product_name": "Premium T-Shirt",
"product_image": "https://example.com/wp-content/uploads/product.jpg",
"quantity": 2,
"subtotal": "39.98",
"total": "39.98",
"meta_data": []
}
],
"totals": [
{
"key": "subtotal",
"label": "Subtotal",
"value": "$39.98"
},
{
"key": "shipping",
"label": "Shipping",
"value": "$5.00"
},
{
"key": "total",
"label": "Total",
"value": "$44.98"
}
],
"needs_payment": false,
"needs_shipping": true,
"has_downloads": false,
"download_url": null
}{
"code": "<string>",
"message": "<string>",
"data": {
"status": 123
}
}{
"code": "<string>",
"message": "<string>",
"data": {
"status": 123
}
}{
"code": "<string>",
"message": "<string>",
"data": {
"status": 123
}
}Order Received
Retrieve order details for the thank you page after checkout completion
GET
/
order-received
/
{order_id}
Get order received details
curl --request GET \
--url {protocol}://{host}/wp-json/cocart/preview/order-received/{order_id} \
--header 'Authorization: Basic <encoded-value>'import requests
url = "{protocol}://{host}/wp-json/cocart/preview/order-received/{order_id}"
headers = {"Authorization": "Basic <encoded-value>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Basic <encoded-value>'}};
fetch('{protocol}://{host}/wp-json/cocart/preview/order-received/{order_id}', 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/order-received/{order_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{protocol}://{host}/wp-json/cocart/preview/order-received/{order_id}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Basic <encoded-value>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("{protocol}://{host}/wp-json/cocart/preview/order-received/{order_id}")
.header("Authorization", "Basic <encoded-value>")
.asString();require 'uri'
require 'net/http'
url = URI("{protocol}://{host}/wp-json/cocart/preview/order-received/{order_id}")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Basic <encoded-value>'
response = http.request(request)
puts response.read_body{
"order_id": 789,
"order_number": "789",
"order_key": "wc_order_abc123xyz",
"status": "processing",
"status_name": "Processing",
"date_created": "December 15, 2024, 2:20 pm",
"date_paid": "December 15, 2024, 2:21 pm",
"currency": "USD",
"total": "44.98",
"subtotal": "39.98",
"tax_total": "0.00",
"shipping_total": "5.00",
"discount_total": "0.00",
"payment_method": "stripe",
"payment_method_title": "Credit Card (Stripe)",
"customer_id": 123,
"customer_note": "Please leave at the door",
"billing_address": {
"first_name": "John",
"last_name": "Doe",
"email": "john@example.com",
"phone": "+1234567890",
"address_1": "123 Main St",
"address_2": "Apt 4B",
"city": "Anytown",
"state": "CA",
"postcode": "12345",
"country": "US",
"company": ""
},
"shipping_address": {
"first_name": "John",
"last_name": "Doe",
"address_1": "123 Main St",
"address_2": "Apt 4B",
"city": "Anytown",
"state": "CA",
"postcode": "12345",
"country": "US",
"company": ""
},
"items": [
{
"item_id": 1,
"product_id": 456,
"variation_id": 0,
"product_name": "Premium T-Shirt",
"product_image": "https://example.com/wp-content/uploads/product.jpg",
"quantity": 2,
"subtotal": "39.98",
"total": "39.98",
"meta_data": []
}
],
"totals": [
{
"key": "subtotal",
"label": "Subtotal",
"value": "$39.98"
},
{
"key": "shipping",
"label": "Shipping",
"value": "$5.00"
},
{
"key": "total",
"label": "Total",
"value": "$44.98"
}
],
"needs_payment": false,
"needs_shipping": true,
"has_downloads": false,
"download_url": null
}{
"code": "<string>",
"message": "<string>",
"data": {
"status": 123
}
}{
"code": "<string>",
"message": "<string>",
"data": {
"status": 123
}
}{
"code": "<string>",
"message": "<string>",
"data": {
"status": 123
}
}This endpoint is currently shown as a preview of what’s currently in development and is subject to change.
Authorizations
basicAuthbearerAuth
WordPress username and password
Path Parameters
Unique identifier for the order
Query Parameters
Order key for verification
Response
Order received details retrieved successfully
Order ID
Order number
Order key
Order status
Human-readable order status
Order creation date
Order payment date
Order currency
Order total
Order subtotal
Tax total
Shipping total
Discount total
Payment method ID
Payment method title
Customer ID
Customer note
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Whether order requires payment
Whether order needs shipping
Whether order has downloadable items
URL to download items
Show child attributes
Show child attributes