Cannot find Payment ID

My payment provider references to Shopify payments/orders with something called “shopify_payment_id” (See code below).

Now I’m trying to use the Shopify API to find the order number belonging to this shopify_payment_id but there I’m stalling. When I enter this payment ID in the search field within the store admin it finds the order. But when I look at the json of that order this value does not exist there. So my questions are:

Where is this value stored?

EDIT: So after posting this I found that this payment_id is under https://admin.shopify.com/store//orders/5755817263499/transactions/6960188686611.json

Remains the question:

What API endpoint do I need to call to get the order ID belonging to this payment ID? (Can I reproduce the store admin search functionality somehow with the REST API or GraphiQL to retrieve the order ID?)

Payment provider partial data:

"metadata": {
"origin_domain": "

Hi there :waving_hand:

Did a query similar to the following work for you? This is using the GraphQL Admin API.

{
  orders(first: 5 query:"payment_id:1234567") {
    edges {
      node {
        id
        customer {
          id
        }
      }
    }
  }
}

That throws me a ““message”: “Access denied for orders field.”” error even when using the Shopify GraphiQL App. I read a lot about the read_all_orders scope but that I cannot find anywhere within my store.

When you installed the GraphiQL App you would have selected the scopes you want the app to have access to. You may not have selected the orders scope initially.

I would recommend uninstalling and reinstalling the GraphiQL app and reviewing the scopes selected. Or try using a different API client like Postman or Insomnia.

I am able to uses this above query to return the selected order, when I am using an API key that has access.

Now trying it with Insomnia and this it the GraphiQL query I need to get the order number. Getting somewhere now :slightly_smiling_face: Just need to get it working in Power Automate now.

{
orders(first: 5 query:"payment_id:rXPhqy93MKjdjfTESTksksks") {
edges {
node {
name
customer {
id
}
}
}
}
}

Managed to finish the Power Automate flow with the correct output. Thank you :slightly_smiling_face: