Get Order
curl --request GET \
--url https://api.khaime.com/api/v1/order/{id} \
--header 'Authorization: <authorization>' \
--header 'X-API-Key: <x-api-key>'import requests
url = "https://api.khaime.com/api/v1/order/{id}"
headers = {
"X-API-Key": "<x-api-key>",
"Authorization": "<authorization>"
}
response = requests.get(url, headers=headers)
print(response.text)const options = {
method: 'GET',
headers: {'X-API-Key': '<x-api-key>', Authorization: '<authorization>'}
};
fetch('https://api.khaime.com/api/v1/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 => "https://api.khaime.com/api/v1/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: <authorization>",
"X-API-Key: <x-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"
"net/http"
"io"
)
func main() {
url := "https://api.khaime.com/api/v1/order/{id}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("X-API-Key", "<x-api-key>")
req.Header.Add("Authorization", "<authorization>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.khaime.com/api/v1/order/{id}")
.header("X-API-Key", "<x-api-key>")
.header("Authorization", "<authorization>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.khaime.com/api/v1/order/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["X-API-Key"] = '<x-api-key>'
request["Authorization"] = '<authorization>'
response = http.request(request)
puts response.read_body{
"status": true,
"message": "Order retrieved",
"data": {
"id": "txn_abc123",
"status": "completed",
"payment_status": "paid",
"fulfillment_status": "shipped",
"subtotal": 5998,
"discount": 600,
"shipping": 599,
"tax": 432,
"total": 5829,
"currency": "USD",
"items": [
{
"product_id": 12345,
"product_title": "Premium T-Shirt",
"variant_label": "Size: Medium",
"quantity": 2,
"unit_price": 2999,
"total": 5398
}
],
"shipping_address": {
"first_name": "John",
"last_name": "Doe",
"address": "123 Main St",
"city": "New York",
"state": "NY",
"zip_code": "10001",
"country": "US"
},
"tracking": {
"carrier": "UPS",
"tracking_number": "1Z999AA10123456784",
"tracking_url": "https://..."
},
"additional_information": [
{
"product_id": 12345,
"values": { "gift_note": "Happy Birthday!", "size": "M" }
}
],
"created_at": "2024-01-15T10:30:00Z",
"updated_at": "2024-01-16T14:20:00Z"
}
}
Commerce API
Get Order
Get details of a specific order
GET
/
order
/
{id}
Get Order
curl --request GET \
--url https://api.khaime.com/api/v1/order/{id} \
--header 'Authorization: <authorization>' \
--header 'X-API-Key: <x-api-key>'import requests
url = "https://api.khaime.com/api/v1/order/{id}"
headers = {
"X-API-Key": "<x-api-key>",
"Authorization": "<authorization>"
}
response = requests.get(url, headers=headers)
print(response.text)const options = {
method: 'GET',
headers: {'X-API-Key': '<x-api-key>', Authorization: '<authorization>'}
};
fetch('https://api.khaime.com/api/v1/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 => "https://api.khaime.com/api/v1/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: <authorization>",
"X-API-Key: <x-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"
"net/http"
"io"
)
func main() {
url := "https://api.khaime.com/api/v1/order/{id}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("X-API-Key", "<x-api-key>")
req.Header.Add("Authorization", "<authorization>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.khaime.com/api/v1/order/{id}")
.header("X-API-Key", "<x-api-key>")
.header("Authorization", "<authorization>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.khaime.com/api/v1/order/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["X-API-Key"] = '<x-api-key>'
request["Authorization"] = '<authorization>'
response = http.request(request)
puts response.read_body{
"status": true,
"message": "Order retrieved",
"data": {
"id": "txn_abc123",
"status": "completed",
"payment_status": "paid",
"fulfillment_status": "shipped",
"subtotal": 5998,
"discount": 600,
"shipping": 599,
"tax": 432,
"total": 5829,
"currency": "USD",
"items": [
{
"product_id": 12345,
"product_title": "Premium T-Shirt",
"variant_label": "Size: Medium",
"quantity": 2,
"unit_price": 2999,
"total": 5398
}
],
"shipping_address": {
"first_name": "John",
"last_name": "Doe",
"address": "123 Main St",
"city": "New York",
"state": "NY",
"zip_code": "10001",
"country": "US"
},
"tracking": {
"carrier": "UPS",
"tracking_number": "1Z999AA10123456784",
"tracking_url": "https://..."
},
"additional_information": [
{
"product_id": 12345,
"values": { "gift_note": "Happy Birthday!", "size": "M" }
}
],
"created_at": "2024-01-15T10:30:00Z",
"updated_at": "2024-01-16T14:20:00Z"
}
}
Get Order
Returns detailed information about a specific order. Requires customer authentication.Request
string
required
Your API key
string
required
Customer token:
Bearer {token}string
required
The order/transaction ID
Response
{
"status": true,
"message": "Order retrieved",
"data": {
"id": "txn_abc123",
"status": "completed",
"payment_status": "paid",
"fulfillment_status": "shipped",
"subtotal": 5998,
"discount": 600,
"shipping": 599,
"tax": 432,
"total": 5829,
"currency": "USD",
"items": [
{
"product_id": 12345,
"product_title": "Premium T-Shirt",
"variant_label": "Size: Medium",
"quantity": 2,
"unit_price": 2999,
"total": 5398
}
],
"shipping_address": {
"first_name": "John",
"last_name": "Doe",
"address": "123 Main St",
"city": "New York",
"state": "NY",
"zip_code": "10001",
"country": "US"
},
"tracking": {
"carrier": "UPS",
"tracking_number": "1Z999AA10123456784",
"tracking_url": "https://..."
},
"additional_information": [
{
"product_id": 12345,
"values": { "gift_note": "Happy Birthday!", "size": "M" }
}
],
"created_at": "2024-01-15T10:30:00Z",
"updated_at": "2024-01-16T14:20:00Z"
}
}
Custom Field Answers
additional_information carries the customer’s answers to any per-product custom
fields, so no second lookup is needed to display them.
It is an array rather than an object because one order can cover several products,
each with its own field set — match on product_id to find the entry for a given
line item. Products with no custom fields have no entry at all.
Answers are keyed by each field’s id; the matching label for display lives on
the product. See Product Custom Fields.
Order Statuses
| Status | Description |
|---|---|
pending | Order created, awaiting payment |
processing | Payment received, preparing order |
completed | Order fulfilled |
cancelled | Order was cancelled |
refunded | Order was refunded |
Errors
| Error Code | Description |
|---|---|
ORDER_NOT_FOUND | Order doesn’t exist |
AUTH_PERMISSION_DENIED | Order belongs to another customer |
Example
curl "https://api.khaime.com/api/v1/order/txn_abc123" \
-H "X-API-Key: pk_live_your_api_key" \
-H "Authorization: Bearer eyJhbGciOiJIUzI1NiIs..."
