Get the Order Id that belongs to a PaymentId

Solved

Get the Order Id that belongs to a PaymentId

Tenriez
Shopify Partner
3 0 0

Hello there,

I am looking for a method to get the orderId that belongs to a certain paymentId.
I can only find methods to look up the paymentId of the different transactions that belong to an order through the orderId. However I want to be able to find it the other way around.

 

The reason that I want to do this is because the Payment provider that I am using only stores the paymentId as part of the transaction. We would like to enrich this metadata with the orderId for administration purposes.

Accepted Solution (1)

guest4
Shopify Partner
101 7 24

This is an accepted solution.

The orders GraphQL query accepts payment_id as a query parameter:

{
  orders(first: 1, query:"payment_id:...") {
    edges {
      node {
        id
        transactions {
          paymentId
        }
      }
    }
  }
}

 Reference: https://shopify.dev/docs/api/admin-graphql/2023-01/queries/orders

View solution in original post

Replies 5 (5)

guest4
Shopify Partner
101 7 24

This is an accepted solution.

The orders GraphQL query accepts payment_id as a query parameter:

{
  orders(first: 1, query:"payment_id:...") {
    edges {
      node {
        id
        transactions {
          paymentId
        }
      }
    }
  }
}

 Reference: https://shopify.dev/docs/api/admin-graphql/2023-01/queries/orders

Tenriez
Shopify Partner
3 0 0

Yes, this is what I was looking for. Thank you very much.

guest4
Shopify Partner
101 7 24

You're welcome. Cheers.

Temur1
Shopify Partner
7 0 0

Hello i am interested if its possible to get the checkout id before the order is created in admin panel i want to have on a checkout page checkout id instead of a payment id is it possible to get this data of checkout id from the payment request ?

ShopifyDevSup
Shopify Staff
1453 238 509

Hey @Temur1 , if you're wanting some of these details before an order is created, you can use the storefront API. This guide here on how to Create and update a cart with the Storefront API is a great starting point! 

 

Hope that helps. 

 

- Kyle G.

Developer Support @ Shopify
- Was this reply helpful? Click Like to let us 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