Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

Issues getting transactions with the Partners API

Solved

Issues getting transactions with the Partners API

nozzlegear
Shopify Partner
4 0 0

Hello, I'm playing around with the Shopify Partners API as a little hobby project. I'm running into an issue with querying transactions though, I can't find any way to actually get any useful information about a transaction. 

The documentation tells me there are many additional transaction objects with additional fields, but I can't seem to use them. Each time I try to add those additional fields to the query, I get an error saying the field doesn't exist on the Transaction type. The only fields I'm able to query are "id" and "createdAt" from the base Transaction interface.

Does anyone know what I'm doing wrong here? I'm pretty stumped, I have no idea how to get any useful information like the amount or even the app that created the transaction.

Some links:

Author of the C# and .NET package ShopifySharp. I wrote a book on building rock-solid Shopify apps with C# and ASP.NET. Grab it at https://nozzlegear.com.
Accepted Solution (1)

abm1
Shopify Partner
1 1 3

This is an accepted solution.

Hey @nozzlegear not exactly sure which what your query is but the structure should be something like this example:

query {
  transactions {
    edges {
      node {
        id
        createdAt
        ... on AppSubscriptionSale {
          shop {
            name
          }
          netAmount{
              amount
              currencyCode
          }
        }
      }
    }
  }
}

 Basically, I am using AppSubscriptionSale object here, but can implement with any of the others following this structures that Transactions implements.

Hope this helps!

View solution in original post

Replies 2 (2)

abm1
Shopify Partner
1 1 3

This is an accepted solution.

Hey @nozzlegear not exactly sure which what your query is but the structure should be something like this example:

query {
  transactions {
    edges {
      node {
        id
        createdAt
        ... on AppSubscriptionSale {
          shop {
            name
          }
          netAmount{
              amount
              currencyCode
          }
        }
      }
    }
  }
}

 Basically, I am using AppSubscriptionSale object here, but can implement with any of the others following this structures that Transactions implements.

Hope this helps!

nozzlegear
Shopify Partner
4 0 0

@abm1Thank you so much! That's exactly what I was looking for, it worked perfectly.

Author of the C# and .NET package ShopifySharp. I wrote a book on building rock-solid Shopify apps with C# and ASP.NET. Grab it at https://nozzlegear.com.