create annual recurring charge, retrieve it and webhooks

create annual recurring charge, retrieve it and webhooks

itulo
Tourist
3 0 3

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!

Reply 1 (1)

itulo
Tourist
3 0 3

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.