List Orders
curl --request GET \
--url https://api.khaime.com/api/v1/orders \
--header 'Authorization: <authorization>' \
--header 'X-API-Key: <x-api-key>'import requests
url = "https://api.khaime.com/api/v1/orders"
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/orders', 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/orders",
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/orders"
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/orders")
.header("X-API-Key", "<x-api-key>")
.header("Authorization", "<authorization>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.khaime.com/api/v1/orders")
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": "Orders retrieved",
"data": {
"orders": [
{
"id": "txn_abc123",
"status": "completed",
"total": 5829,
"currency": "USD",
"items": [
{
"product_id": 12345,
"product_title": "Premium T-Shirt",
"quantity": 2,
"price": 2999
}
],
"created_at": "2024-01-15T10:30:00Z"
}
],
"pagination": {
"page": 1,
"limit": 20,
"total": 5
}
}
}
Commerce API
List Orders
Get customer’s order history
GET
/
orders
List Orders
curl --request GET \
--url https://api.khaime.com/api/v1/orders \
--header 'Authorization: <authorization>' \
--header 'X-API-Key: <x-api-key>'import requests
url = "https://api.khaime.com/api/v1/orders"
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/orders', 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/orders",
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/orders"
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/orders")
.header("X-API-Key", "<x-api-key>")
.header("Authorization", "<authorization>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.khaime.com/api/v1/orders")
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": "Orders retrieved",
"data": {
"orders": [
{
"id": "txn_abc123",
"status": "completed",
"total": 5829,
"currency": "USD",
"items": [
{
"product_id": 12345,
"product_title": "Premium T-Shirt",
"quantity": 2,
"price": 2999
}
],
"created_at": "2024-01-15T10:30:00Z"
}
],
"pagination": {
"page": 1,
"limit": 20,
"total": 5
}
}
}
List Orders
Returns the authenticated customer’s order history. Requires customer authentication.Request
string
required
Your API key
string
required
Customer token:
Bearer {token}Query Parameters
integer
default:"1"
Page number
integer
default:"20"
Items per page
Response
{
"status": true,
"message": "Orders retrieved",
"data": {
"orders": [
{
"id": "txn_abc123",
"status": "completed",
"total": 5829,
"currency": "USD",
"items": [
{
"product_id": 12345,
"product_title": "Premium T-Shirt",
"quantity": 2,
"price": 2999
}
],
"created_at": "2024-01-15T10:30:00Z"
}
],
"pagination": {
"page": 1,
"limit": 20,
"total": 5
}
}
}
Errors
| Error Code | Description |
|---|---|
AUTH_TOKEN_EXPIRED | Customer token has expired |
AUTH_TOKEN_INVALID | Invalid customer token |
Example
curl "https://api.khaime.com/api/v1/orders?page=1&limit=10" \
-H "X-API-Key: pk_live_your_api_key" \
-H "Authorization: Bearer eyJhbGciOiJIUzI1NiIs..."
⌘I
