Specific information (shipping and payment details) from GraphQL API Order object

Solved
joetreeline
Visitor
2 0 0
I am working on the Cue Health mobile app, and we are running into a stumbling block when trying to gather information for orders that have been placed previously.
 
Our GraphQL query snippet looks like this:
fun getOrderDetailQuery(orderId: String) = Storefront.query { rootQuery ->
rootQuery.node(ID(orderId)) { nodeQuery ->
nodeQuery.onOrder { orderQuery ->
orderQuery
.name()
.fulfillmentStatus()
.processedAt()
.orderNumber()
.shippingAddress { query ->
query
.name()
.address1()
.address2()
.city()
.province()
.provinceCode()
.country()
.zip()
.phone()

}
.lineItems({ it.first(100) }, {
it.edges {
it.node { liteItemQuery ->
liteItemQuery.title()
liteItemQuery.quantity()
liteItemQuery.originalTotalPrice { query ->
query.amount().currencyCode()
}
liteItemQuery.variant { query ->
query.image { it ->
it.originalSrc()
}
}
}
}
})
.totalPriceV2 { query ->
query.amount().currencyCode()
}
.subtotalPriceV2 { query ->
query.amount().currencyCode()
}
.totalTaxV2 { query ->
query.amount().currencyCode()
}
.totalShippingPriceV2 { query ->
query.amount().currencyCode()
}
}
}
}
We are having trouble tracking down four more pieces of information:
  • Total discount dollar amount
  • Payment details comprised of credit card type and last 4 digits: Visa ending in 1234
  • Shipping Type: UPS Ground
  • Expected Shipping Timeframe: 3 -5 Business Days
 
I have explored the available objects in the GraphQL's Order object, and can't find a way to connect the dots to these pieces of information. Can you help point us in the right direction?
Accepted Solution (1)
CalD
Shopify Staff
Shopify Staff
140 22 35

This is an accepted solution.

Hey @joetreeline,

The Order information available from the Storefront API (docs) is much more limited than the Admin API due to its unauthenticated nature. The Admin API is a better source of the information you're interested in, but you'd need to make calls to the Admin API from a server, not the mobile app though.

Check out these Admin API Order docs: https://shopify.dev/api/admin/graphql/reference/orders/order - there's a currentTotalDiscountsSet, a transactions connection you can get payment details from, a shippingLine connection, and a fulfillment connection (which has an estimatedDeliveryAt property).

CalD | Developer Support @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

View solution in original post

Replies 2 (2)
CalD
Shopify Staff
Shopify Staff
140 22 35

This is an accepted solution.

Hey @joetreeline,

The Order information available from the Storefront API (docs) is much more limited than the Admin API due to its unauthenticated nature. The Admin API is a better source of the information you're interested in, but you'd need to make calls to the Admin API from a server, not the mobile app though.

Check out these Admin API Order docs: https://shopify.dev/api/admin/graphql/reference/orders/order - there's a currentTotalDiscountsSet, a transactions connection you can get payment details from, a shippingLine connection, and a fulfillment connection (which has an estimatedDeliveryAt property).

CalD | Developer Support @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

joetreeline
Visitor
2 0 0

Thanks for confirming Cal. We will rely on the Admin API for that information.

 

Thanks

-Joe