Skip to main content

Fetching Orders

These queries are authenticated using the customer's API key. Keep the API key in your front-end app's state (it is available via the customerAuth query).

Pass the customer's API key and the Authorization header like this:

{
"Authorization": "Bearer <Partner JWT>",
"x-customer-api-key": "<Customer API Key>"
}

Fetching a single orders

You can load an order using the following query:

query GetOrder($transactionId: ID, $cartId: ID) {
getOrder(transactionId: $transactionId, cartId: $cartId) {
transactionId
status
customerDetails {
contactNum
email
lastName
firstName
address {
lat
lng
zip
lineOne
lineTwo
city
country
flatNumber
}
}
delivery {
status
driver {
firstName
lastName
contactNumber
transportType
lat
lng
}
pincode
}
fulfillment {
type
orderType
window {
from
to
}
}
orderItems {
image
modifierGroups {
name
modifiers {
name
price {
basePrice
}
quantity
}
}
name
options {
name
values
}
quantity
total {
basePrice
}
}
additionalItems {
giftWrapping {
message
price {
basePrice
}
}
}
summary {
storeFee {
basePrice
}
delivery {
basePrice
}
deliveryChargeInfo {
deliveryChargeReduction
deliveryChargeReductionReason
deliveryPricingBand {
lowerThreshold
upperThreshold
percentageDiscount
}
}
discount {
amount
code
description
}
subtotal {
basePrice
}
total {
basePrice
}
}
storeInformation {
name
contactNumber
address {
lat
lng
lineOne
lineTwo
city
zip
}
}
}
}

Sample response:

{
"data": {
"getOrder": {
"additionalItems": {
"giftWrapping": {
"message": null,
"price": {
"basePrice": "0.00"
}
}
},
"customerDetails": {
"address": {
"city": null,
"country": null,
"flatNumber": null,
"lat": null,
"lineOne": null,
"lineTwo": null,
"lng": null,
"zip": null
},
"contactNum": "+4477812674958",
"email": "[email protected]",
"firstName": "Loyal",
"lastName": "Customer"
},
"delivery": null,
"fulfillment": {
"type": "PICKUP",
"window": {
"from": "2023-08-08T14:15:00.000000Z",
"to": "2023-08-08T14:30:00.000000Z"
},
"orderType": "SAMEDAY"
},
"orderItems": [
{
"image": "https://assets.slerp.com/uploads/images/variant/bd64240a-be4b-4951-a52e-9255f94281cb/bd64240a-be4b-4951-a52e-9255f94281cb_DSCF4627.jpg_thumb.jpg?v=63856820826",
"modifierGroups": [],
"name": "Product",
"options": null,
"quantity": 7,
"total": {
"basePrice": "36.75"
}
}
],
"status": "accepted",
"storeInformation": {
"address": {
"city": "Kings Cross",
"lat": 52.3815986,
"lineOne": "Kings Cross Station",
"lineTwo": "",
"lng": -2.4593726,
"zip": "N1 1NA"
},
"contactNumber": "+447787765153",
"name": "Bath"
},
"summary": {
"storeFee": {
"basePrice": "0.00"
},
"delivery": {
"basePrice": "0.00"
},
"deliveryChargeInfo": {
"deliveryChargeReduction": "0.00",
"deliveryChargeReductionReason": null,
"deliveryPricingBand": null
},
"discount": {
"amount": null,
"code": null,
"description": null
},
"subtotal": {
"basePrice": "36.75"
},
"total": {
"basePrice": "36.75"
}
},
"transactionId": "2YUDYZ"
}
}
}

To get order & delivery updates we recommend polling every 60 seconds while the success page is open:

query GetOrder($transactionId: ID, $cartId: ID) {
getOrder(transactionId: $transactionId, cartId: $cartId) {
delivery {
status
driver {
lat
lng
}
}
fulfillment {
window {
from
to
}
}
status
transactionId
}
}

The lat and lng can be used to plot driver location.

If a driver is not yet assigned this field will be null.

This will respond with a status. This status can either be pending, accepted, rejected or done.

  • Pending: The order has been sent to the store but not yet accepted
  • Accepted: The order has been accepted by the store and is being made, card is debited at this time
  • Done: The store believes the order has been delivered
  • Rejected: The order has been rejected by the store, no charge made to user.

Fetching orders for a customer

query GetCustomerOrders($customerId: ID) {
getOrdersForCustomer(customerId: $customerId) {
summary {
storeFee {
basePrice
}
delivery {
basePrice
}
deliveryChargeInfo {
deliveryChargeReduction
deliveryChargeReductionReason
deliveryPricingBand {
lowerThreshold
upperThreshold
percentageDiscount
}
}
discount {
amount
code
description
}
subtotal {
basePrice
}
total {
basePrice
}
}
additionalItems {
giftWrapping {
message
price {
basePrice
}
}
}
customerDetails {
contactNum
email
lastName
firstName
address {
lat
lng
zip
lineOne
lineTwo
city
country
flatNumber
}
}
delivery {
status
driver {
firstName
lastName
contactNumber
transportType
lat
lng
}
pincode
}
fulfillment {
type
orderType
window {
from
to
}
}
orderItems {
image
modifierGroups {
name
modifiers {
name
price {
basePrice
}
quantity
}
}
name
options {
name
values
}
quantity
total {
basePrice
}
}
status
storeInformation {
name
contactNumber
address {
lat
lng
lineOne
lineTwo
city
zip
}
}
transactionId
}
}