Accessing Product Data from a Payment Session Before Order Creation

Hello Shopify Community,

I’m working on integrating an off-site payment provider with a Shopify store. My current challenge involves retrieving detailed product data (specifically, line items) before the final order creation.

During the payment processing stage, I successfully receive a payment session and gather essential data. However, the crucial piece of information I need is the line item details of the products in the customer’s cart, which, unfortunately, are not included in the payment session data.

To address this, I attempted a GraphQL query using the ID of the Payment Session as $queryString (payment_id:XXXXXXXXXX):

query GetOrders($queryString: String!) {
    orders(first: 1, query: $queryString) {
        nodes {
            id,
            name,
            lineItems(first:20) {
                edges {
                    node {
                        id,
                        name,
                        title,
                        quantity,
                        unfulfilledQuantity,
                    }
                }
            }
        }
    }
}

However, this approach falls short because the order isn’t created yet at this stage, and as such, the query doesn’t return the desired line item data.

My question is: How can I access the line items (product details) for a customer’s purchase before the Shopify order is officially created? Are there any specific Shopify APIs or methods that enable access to this data during the payment session phase?

Any advice or guidance on how to navigate this issue would be highly appreciated. I’m looking for a solution that allows me to preemptively handle any potential errors or issues during the payment processing, by having access to the full details of what the customer is purchasing.

Thank you for your time and help!

You can’t access order scope with a payment app. At least this is the feedback I have from Shopify team. You can’t fetch order data, even after the order is created (which is what I tried to do), because you will get “access denied”.

@vildanbina did you have any luck on this? Same issue here :expressionless_face: