Skip to main content

Does RC provide through any of the SDKs type definitions for their Webhook Events? I’m working in NodeJS and want to receive webhooks to keep some state locally. I can see their examples and write my own type definitions, but the Best Practices state,

“You should be able to handle webhooks that include additional fields to what's shown here, including new event types. We may add new fields or event types in the future without changing the API version.”

It would be preferable to have an officially supported set of these objects and types, similar to what Stripe provides for their events, for folks out there that want to process Webhooks events because the documentation leaves some things ambiguous.

For example, in the section on Subscription Lifecycle Event Fields, it says that tax_percentage can be NULL if unknown. Then on the Webhooks Sample Events page, tax_percentage is completely absent in some examples (Renewal), present in some (Uncancellation), and NULL in others (Billing Issue). This makes it really hard to understand exactly what will be present in the different message types. In NodeJS, absent values (undefined) and NULL values are two completely different things.

Lacking official type definitions, could we at least get clearer documentation on the Webhook events to indicate whether it will always be present; whether it will always be present, but possibly NULL, and when it may not be present at all?

Thanks...

Hi! Thank you for this thorough write-up of this issue. You are correct that this ambiguity in terms of Webhooks can cause some difficulty on the end of developers. I'll go ahead and share these feature suggestions with the rest of the team, as well as the suggestions for improvements in the documentation. While we don't have a concrete roadmap or ETA yet, the team will work to get this prioritized.


Thanks, @wes_clark. Are there any plans to bundle the purchases-capacitor so that it works in a NodeJS environment? It would be great to have access to some of the features in the SDK, like activeSubscriptions in CustomerInfo, that require some interpretation of results from the REST API.


I want this too


I’ve tried to put together a pretty comprehensive bundle of all the types based on the docs + samples, https://www.npmjs.com/package/@puzzmo/revenue-cat-webhook-types if folks want to work together on getting all the nullability etc correct


Reply