shippingPrice
Overview
Get the shipping price for a destination city. Useful during checkout to estimate delivery cost.
- Type: GraphQL Query
- Endpoint: https://subdomain.com
- Authentication:
Authorization: Bearer <TOKEN>(if required by your setup)
Query
query GetShippingPrice($city: ID!) {
getShippingPrice(city: $city) {
success
message
data {
price
}
}
}
Variables
{
"city": "<CITY_ID>"
}
Examples
- cURL
- JavaScript (fetch)
curl -X POST \
https://subdomain.com\
-H "Content-Type: application/json" \
-H "Authorization: Bearer <TOKEN>" \
--data-binary @- << 'EOF'
{
"query": "query GetShippingPrice($city: ID!) { getShippingPrice(city: $city) { success message data { price } } }",
"variables": { "city": "<CITY_ID>" }
}
EOF
const res = await fetch('https://subdomain.com', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
Authorization: 'Bearer ' + token,
},
body: JSON.stringify({
query: `
query GetShippingPrice($city: ID!) {
getShippingPrice(city: $city) {
success
message
data { price }
}
}
`,
variables: { city: '<CITY_ID>' },
}),
});
const json = await res.json();
Notes
- Replace
<CITY_ID>with a valid destination city ID. - If your checkout flow requires additional context (e.g., weight, courier), ensure the backend uses defaults or add a mutation that sets those before this query.