APP_SUBSCRIPTIONS_UPDATE webhook response

Solved
Alex_Buran
Tourist
4 0 0

Hello community,

 

I'm looking for APP_SUBSCRIPTIONS_UPDATE webhook response. I could add it using GraphQl, but I can find response of this webhook. This is the only documentation about webhook responses I found, but there is no APP_SUBSCRIPTIONS_UPDATE event. I also can't find a way how to test this event.

I would appreciate any help.

Thank you in advance!

0 Likes
Shaibt
Excursionist
16 1 10

This is an accepted solution.

Hi Alex,

I'm successfully using this webhook.

Setting it using this mutation (API version 2020-04):

webhookSubscriptionCreate(topic: APP_SUBSCRIPTIONS_UPDATE , webhookSubscription: {callbackUrl: "${appSubcriptionCB}", format: JSON}) {
                      webhookSubscription {
                        id
                        callbackUrl
                        format
                        topic
                      }
                      userErrors {
                        field
                        message
                      }
                    }

I'm receiving the webhook every time there's a status change in the app subscription.

The webhook body will include these fields:

{
admin_graphql_api_id, 
name, 
status,
admin_graphql_api_shop_id,
created_at, 
updated_at
}

 

 

Alex_Buran
Tourist
4 0 0

Hi Shaibt!

Thank you for your reply! I appreciate it!

Do you have any idea how can I test it, other than waiting until some subscription is changed?

Thank you in advance!

0 Likes
Shaibt
Excursionist
16 1 10

You can create test app subscription charges using a mutation such as:

mutation appSubscriptionCreate($name: String!, $lineItems: [AppSubscriptionLineItemInput!]!, $returnUrl: URL!, $test: Boolean, $trialDays: Int) {
        appSubscriptionCreate(name: $name, lineItems: $lineItems, returnUrl: $returnUrl, test: $test, trialDays: $trialDays) {
            appSubscription {
                id
                createdAt
                lineItems {
                  id
                  plan {
                    pricingDetails {
                      __typename
                    }
                  }
                }
            }
            confirmationUrl
            userErrors {
                field
                message
            }
        }
      }`

Just make sure you set test to Boolean 'true'

Alex_Buran
Tourist
4 0 0

Awesome! Thank you so much! That is what I was looking for :)

0 Likes