Get all transactions of a given order in graphQL

The accepted solution below:
Solved: Get all transactions of a given order in graphQL - Shopify Community

{
  order(id: "gid://shopify/Order/450789469") {
    transactions(first: 100) {
      edges {
        node {
          id
          kind
          status
          amountSet {
            shopMoney {
              amount
              currencyCode
            }
            presentmentMoney {
              amount
              currencyCode
            }
          }
        }
      }
    }
  }
}

returns:
“message”: “Field ‘edges’ doesn’t exist on type ‘OrderTransaction’”,

I tried:

{
  order(id:"gid://shopify/Order/5670403899463") {
    transactions {
        id
        accountNumber

        amountSet{
           presentmentMoney{
                amount
                currencyCode
           }
           shopMoney{
                amount
                currencyCode
           }
        }

        authorizationCode
        authorizationExpiresAt
        createdAt
        errorCode

        fees {
            id
            amount {
                amount
                currencyCode
            }
            flatFee {
                amount
                currencyCode
            }
            flatFeeName
            rate
            rateName
            taxAmount {
                amount
                currencyCode
            }
            type
        }

        gateway
        kind
        maximumRefundableV2 {
            amount
            currencyCode
        }
        order{
            id
        }
        parentTransaction {
            accountNumber
        }
        paymentDetails{
            ...on CardPaymentDetails{
                avsResultCode
                name
                company
                expirationMonth
                expirationYear
                bin
            }
        }
        paymentIcon{
            altText
            height
            width
            id
            url
        }
        paymentId
        processedAt
        receiptJson
        settlementCurrency
        settlementCurrencyRate
        status
        test
        totalUnsettledSet{
            presentmentMoney{
                amount
                currencyCode
           }
           shopMoney{
                amount
                currencyCode
           }
        }
    }
  }
}

That works.

Is it possible to use a criteria as: id:>“gid://shopify/Order/5670403899463”
to reduce the number of calls when collecting a group of orders.

this works on an order connection
orders (first: 10, query: “id:>1” ) {

but this does not:

 order(first: 10, query: "id" > 5670403899463) {
    transactions {
        id
        accountNumber

Thank you.

Well, it looks like you are using order instead of orders and the documentation shows a similar approach just with different syntax that may be the reason why it was not working for you. (Though it looks like you had already mentioned it too…)

Also, you may try asking the .dev Assistant for a code snippet you can test to grab the transactions.

Thanks Rob.

You have a point here. I will continue testing.

I need to figure out Orders → query ==> order ==> transactions in Graph_QL. I am coming from 30 years of SQL. I need all the help I can get.

{
  orders(first: 10, query: "id:>5665656471623") {
    edges{
node{
        id
        transactions {
            id
            kind
            status
          amountSet {
            shopMoney {
              amount
              currencyCode
            }
            presentmentMoney {
              amount
              currencyCode
            }
          }
        }
    }
}
}
}

Thanks for helping. It is obvious.

1 Like