orderByHandle
Overview
Fetch a single order using its public handle. Note: the API argument is spelled handel (as in the schema below).
- Type: GraphQL Query
- Endpoint: https://subdomain.com
- Authentication:
Authorization: Bearer <TOKEN>
Query
query GetOrderByHandle($handel: String!) {
getOrderByHandle(handel: $handel) {
data {
_id
status { _id code title }
type
salesLead {
_id
firstName
lastName
country
city
district
street
phone1
phone2
}
currency { _id title currencyCode currencySymbol }
freeze
taxAmount
totalPriceWithTax
totalPrice
totalCompareAtPrice
priceWithShipping
shippingPrice
handel
paymentMethod {
_id
key
descreption
installed
deleted
schema
createdAt
updatedAt
icon
iconUrl
needConfig
methods
name
instructions
id
}
shippingAddress {
_id
country {
_id
name
image { image imageUrl }
code
continent
capital
active
deleted
phonekey
}
city {
_id
name
description
active
deleted
country {
_id
name
image { image imageUrl }
code
continent
capital
active
deleted
phonekey
}
createdAt
}
neighborhood
zipCode
description
account
device
deleted
createdAt
updatedAt
}
customerName
isPaid
isFastOrder
createdAt
account {
_id
fullname
phone
type
verified
blocked
status
avatar
avatarUrl
country {
_id
name
image { image imageUrl }
code
continent
capital
active
deleted
phonekey
}
deleted
devices
createdAt
updatedAt
}
items {
_id
orderId
productId
variantId
productData { title slug app images price }
variantData {
price
compareAtPrice
options {
_id
option { _id name type product }
label
sortOrder
}
}
quantity
price
compareAtPrice
totalPrice
totalCompareAtPrice
totalSavings
}
}
success
message
}
}
Variables
{
"handel": "<ORDER_HANDLE>"
}
Examples
- cURL
- JavaScript (fetch)
curl -X POST \
https://subdomain.com \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <TOKEN>" \
--data-binary @- << 'EOF'
{
"query": "query GetOrderByHandle($handel: String!) { getOrderByHandle(handel: $handel) { success message data { _id handel totalPrice } } }",
"variables": { "handel": "<ORDER_HANDLE>" }
}
EOF
const res = await fetch('https://subdomain.com', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
Authorization: 'Bearer ' + token,
},
body: JSON.stringify({
query: `
query GetOrderByHandle($handel: String!) {
getOrderByHandle(handel: $handel) {
success
message
data { _id handel totalPrice }
}
}
`,
variables: { handel: '<ORDER_HANDLE>' },
}),
});
const json = await res.json();
Notes
- The argument name is
handelin the schema; pass your order handle under this variable. - Reduce the selected fields to what your UI needs for performance.