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.

We're moving the community! Starting July 7, the current community will be read-only for approx. 2 weeks. You can browse content, but posting will be temporarily unavailable. Learn more

create annual recurring charge, retrieve it and webhooks

Solved

create annual recurring charge, retrieve it and webhooks

itulo
Shopify Partner
4 1 4

Users using my app should be able to choose between a monthly and an annual plan. 

I understand that in order to create a recurring annual charge I need to use the graphql api https://shopify.dev/api/admin-graphql/2022-07/mutations/appsubscriptioncreate.

Question 1: I also want to retrieve the recurring charge at a later time. I don't see a way to do this with the graphql api, but I've seen it's possible with the rest api https://shopify.dev/api/admin-rest/2022-10/resources/recurringapplicationcharge#get-recurring-applic.... However in the object returned I don't see a field for the interval of the charge (monthly or annual?). Is there another way to get this?

 

Question 2: what is (if any) the webhook that is fired when the customer accepts the charge? Looking at this page https://shopify.dev/api/admin-rest/2022-04/resources/webhook I am unsure whether it will be subscription_contracts or subscription_billing_attempts

 

Thanks!

Accepted Solution (1)

itulo
Shopify Partner
4 1 4

This is an accepted solution.

I found the answer to Question 1.

 

It's possible to retrieve an AppSubscription through these graphql queries: https://shopify.dev/apps/billing/reporting#query-for-an-appsubscription

 

For some reason a was expecting to find what I wanted from this page https://shopify.dev/api/admin-graphql, selecting Billing on the side menu, then ' Queries'. But there is nothing useful there. I'm totally new to graphql.

View solution in original post

Reply 1 (1)

itulo
Shopify Partner
4 1 4

This is an accepted solution.

I found the answer to Question 1.

 

It's possible to retrieve an AppSubscription through these graphql queries: https://shopify.dev/apps/billing/reporting#query-for-an-appsubscription

 

For some reason a was expecting to find what I wanted from this page https://shopify.dev/api/admin-graphql, selecting Billing on the side menu, then ' Queries'. But there is nothing useful there. I'm totally new to graphql.