APP_SUBSCRIPTION_UPDATE Webhook

danhho
Shopify Partner
22 1 6

Hi guys, I seting up recurring charge plan in my app, and subscribe app_subscription_update webhook follow docs in https://shopify.dev/docs/apps/billing/subscriptions/recurring-charges-based-on-usage

 

Now I want to update some value in my app when shopify automatic monthly charge success. How can I capture that event? Is above webhook fired?

If it can fire, what is payload I receive this case.

 

If not, how can I capture event when shopify  interval charge monthly success? 

 

Thanks in advance guys. Happy coding

Replies 3 (3)

InsideoutB
Shopify Partner
2 0 2

APP_SUBSCRIPTIONS_UPDATE webhook fires with every subscription status update. It should contain an AppSubscription object. But in my experience the payload contains different data:


admin_graphql_api_id
name
status
admin_graphql_api_shop_id
created_at
updated_at
currency
capped_amount


I would prefer an API end point to get app subscription status (to read specifically: currentPeriodEnd) but without subscription scope access (that our app doesn't get and need) that seems impossible?
zksumon
Shopify Partner
9 0 1

any solution?

InsideoutB
Shopify Partner
2 0 2

 

 

Yes seems like I do have access without the subscription API to this query if I save the store's subscription ID... so I can use the currentPeriodEnd from it

          query {
            node(id: "gid://shopify/AppSubscription/<subsciption_id>") {
              ...on AppSubscription {
                createdAt
                currentPeriodEnd
                id
                name
                status
                test
              }
            }
          }