Topics covering webhook creation & management, event handling, Pub/Sub, and Eventbridge, in Shopify apps.
Hello,
I am currently working on implementing webhook events for my Shopify app and have a couple of questions that I would appreciate your assistance with:
As each merchant configures a different billing cycle in their Shopify backend, I am facing challenges testing the webhook events for subscription billing.
Due to the dev store not approving app subscription fees and our actual store not being on the billing date, I am unable to test if the Shopify subscription webhook sends the actual amount paid by the user to our developer properly. I am specifically interested in testing the following webhook topics:
subscription_billing_attempts/success
subscription_billing_attempts/failure
Could you please guide me on triggering the webhook events for these topics and testing them in a development environment?
Besides, in the context of Shopify subscriptions, I came across the term "Subscription Contract ID." I would like to know if the Subscription Contract ID refers to the same identifier as the Subscription ID. Could you please provide clarification on the relationship between these two terms, if any?
Any help or suggestions would be greatly appreciated. Thank you in advance for your time and assistance.
Best regards,
Keji.
Hey Keji! Good questions.
> Could you please guide me on triggering the webhook events for these topics and testing them in a development environment?
TLDR is I'm afraid I don't have a great answer for you, but we're aware this is a problem.
Unfortunately you've hit on the (very small number of) webhook topics that you cannot manually trigger an event for in your dev store. Part of this is a by-design technical implementation detail: anything related to subscriptions (contracts, selling plans, selling plan groups) are "locked" by API client ID. In other words, the only way an event can be triggered is when a subscription billing event occurs on a real store with the app installed.
This is a bummer, and I raised it with the Subscriptions team. They're aware it's a definite pain point, and are exploring a way to solve soon. In the meantime, the alternative would be to build an interface that creates selling plans + has a button to bill something immediately. But IMO this is an extremely heavy-handed solution that puts a lot of work on your plate.
I'd be curious if anyone else here has solved this problem.
> I would like to know if the Subscription Contract ID refers to the same identifier as the Subscription ID.
Yes! `subscription_contract_id` is the field in the webhook: https://shopify.dev/docs/api/admin-rest/2024-04/resources/webhook#event-topics-subscription-billing-.... It should be the same thing as the subscription ID.