APP_SUBSCRIPTIONS_UPDATE Webhook Not Providing Reason for Trigger

I am trying to use APP_SUBSCRIPTIONS_UPDATE webhook to track subscription changes in my Shopify app. The webhook gets triggered correctly whenever there is a change (such as subscription creation, update, or cancellation). However, the webhook payload does not provide any information about why the update happened.

For example, if a subscription is canceled, I don’t receive details like whether it was canceled, updated or accepted.

Is there a way to get more context on why the subscription update occurred?

 {
   request: {
     method: 'POST',
     url: '/',
     header: {
       'x-shopify-webhook-id': 'some id',
       'x-shopify-triggered-at': '2025-02-11T13:24:22.873029759Z',
       'x-shopify-topic': 'app_subscriptions/update',
       'x-shopify-shop-domain': 'some name',
       'x-shopify-hmac-sha256': 'some id',
       'x-shopify-event-id': 'some id',
       'x-shopify-api-version': '2024-04',
       'x-forwarded-proto': 'https',
       'x-forwarded-for': 'some number',
       'content-type': 'application/json',
       connection: 'close',
       'cf-worker': 'trycloudflare.com',
       'cf-warp-tag-id': 'some id',
       'cf-visitor': '{"scheme":"https"}',
       'cf-ray': 'some id-AMS',
       'cf-ipcountry': 'NL',
       'cf-ew-via': '15',
       'cf-connecting-ip': 'some number',
       'cdn-loop': 'cloudflare; loops=1; subreqs=1',
       'accept-encoding': 'gzip',
       accept: '*/*',
       'content-length': '314',
       'user-agent': 'Shopify-Captain-Hook',
       host: 'some host'
     }
   },
   response: {
     status: 202,
     message: 'Accepted',
     header: [Object: null prototype] {
       'content-security-policy': 'frame-ancestors https://undefined https://admin.shopify.com'
     }
   },
   app: { subdomainOffset: 2, proxy: false, env: 'development' },
   originalUrl: '/webhooks',
   req: '<original node req>',
   res: '<original node res>',
   socket: '<original node socket>'
 }

You will have to read req.body to get those details.

Hi @Gulam_Hussain_Quinn, Thank you for your reply but the issue is that I am not receiving the body key inside the request. You can also check the response I have provided above.

Are you using remix template?

No i am not using that.

Its a node js request, it won’t be logged because its not an object.
You need to get the body using an appropriate method.
What lib/framework are you using?

2 Likes

@JordanFinners thankyou for your reply. I’m using Koa.js and you’re right. When I logged ctx.state, the required data actually appeared.