revenuecat/ai-toolkit/rc-webhooks
Claude Code and agent skill by revenuecat/ai-toolkit
- community
Checking that the SKILL.md file is still in the repository.
Use this skill when consuming RevenueCat webhooks on your backend. Covers authenticating requests (Authorization header, optional HMAC signing), parsing the normalized event schema without breaking on new fields, idempotency via the event id field, every event type, and taking access from a re-read of the customer so CANCELLATION, EXPIRATION, and RENEWAL never grant or revoke the wrong access.
Install
npx vskill@latest install revenuecat/ai-toolkit/rc-webhooksSKILL.md
The same SKILL.md was published earlier as revenuecat/ai-toolkit/rc-webhooks.
RevenueCat Webhooks
You configure one endpoint. RevenueCat posts one normalized JSON event schema for every store. Your job on the server side is to authenticate the request, deduplicate by event.id, and update your records from the customer the event touches.
Phase 1: Discover
Confirm what you are wiring up before touching code.
- You own a server side HTTPS endpoint that accepts POST with a JSON body.
- You set an authorization header value on the webhook integration in the RevenueCat dashboard under Integrations then Webhooks. If you also turn on HMAC webhook signing there, you stored its signing secret, which the dashboard shows only once.
- Google Play Real Time Developer Notifications are connected to RevenueCat. Without them RevenueCat may learn about a refund of a one time purchase only when the app next opens.
- You have durable storage to record processed event IDs and entitlement state per user.
- You have the secret REST API key on the server, to re-read customers with
GET /v1/subscribers/{app_user_id}. - You understand that RevenueCat has already mapped products to entitlements, so the customer it returns lists every entitlement with its
expires_date, expired ones included. You do not maintain a product to entitlement table on your backend.
Every event has this outer shape:
Phase 2: Plan
Take access from the customer, not from the event. For every event that can change access, re-read the customer it touches with GET /v1/subscribers/{app_user_id} and store the entitlements RevenueCat reports now. RevenueCat recommends this after any webhook, and it stays correct when events arrive late or out of order: automatic retries follow after 5, 10, 20, 40, and 80 minutes and a dashboard retry can come any time, so a retried EXPIRATION can land after the event that restored access, and another source (a granted entitlement, another store) can still grant an entitlement that one product's EXPIRATION lists. Use the payload only for what the customer does not carry, such as consumable credits.
| Event type | Meaning | Handler action besides the re-read | |
|---|---|---|---|
INITIAL_PURCHASE | A new subscription was purchased, including the start of a free trial (period_type TRIAL). On Google Play it is also the usual event for a resubscription after an EXPIRATION. | Nothing. | |
RENEWAL | Subscription renewed. Some resubscriptions after an EXPIRATION arrive as RENEWAL too. | Nothing. | |
NON_RENEWING_PURCHASE | A purchase that won't auto renew: a one time product, or an entitlement granted from the dashboard or API (store PROMOTIONAL). | Credit consumables to the user, quantity units when present, keyed by transaction_id, except products whose balance RevenueCat in app currency manages. | |
CANCELLATION | Auto renew turned off, a billing issue was detected, a refund, or a granted entitlement was removed. cancel_reason says which. | Do not revoke from the payload. Reverse any consumable credit recorded for the transaction_id. | |
UNCANCELLATION | User re enabled auto renew before expiry. | Nothing. | |
EXPIRATION | A subscription or a granted entitlement ended. | Nothing. The re-read normally shows the entitlement expired; trust it over entitlement_ids. | |
BILLING_ISSUE | Payment failed. User may be in grace period or on hold. | Optionally start recovery messaging, such as an email; the re-read stores billing_issues_detected_at. Do not revoke. RevenueCat sends EXPIRATION if recovery fails. | |
SUBSCRIPTION_EXTENDED | Expiry pushed back through the store API (for example a defer). On Google Play it can also mean Google deferred a renewal charge by less than 24 hours, and RENEWAL or BILLING_ISSUE follows within a day. | Nothing. | |
SUBSCRIPTION_PAUSED | Google Play subscription scheduled to pause. auto_resume_at_ms says when it resumes. | Nothing. Access ends later with EXPIRATION (expiration_reason SUBSCRIPTION_PAUSED). | |
TEMPORARY_ENTITLEMENT_GRANT | Short lived outage grant (up to 24h). Carries only app_user_id and sometimes store. | Nothing; the payload has no entitlement or expiry fields. INITIAL_PURCHASE follows if the store later validates the purchase, EXPIRATION if it does not. | |
PRODUCT_CHANGE | User switched plan (upgrade, downgrade, or cross grade). | Nothing. On Google Play, new_product_id marks a deferred change: product_id is still the current product, and the new one takes effect at the next renewal, when the re-read shows it (RevenueCat's docs name both INITIAL_PURCHASE and RENEWAL for that moment). | |
TRANSFER | Purchases moved from the IDs in transferred_from to the IDs in transferred_to. No app_user_id on this event. | Re-read every ID on both sides. Do not merge the users. | |
PURCHASE_REDEEMED | A web purchase (Paddle, RevenueCat Billing, or Stripe) was redeemed in the app through a redemption link. No app_user_id. redemption_outcome is alias, transfer (a TRANSFER is sent too), or redeemer_owns. | Re-read the redeemer in redeemed_by, which RevenueCat sends only sometimes. | |
REFUND_REVERSED | App Store only. A refund was reversed. | Restore any consumable credit you reversed for the transaction_id. | |
SUBSCRIBER_ALIAS | Deprecated. Two app user IDs were merged into one identity. | Legacy projects only: merge your local records for the IDs in aliases. New projects don't receive this event. | |
PRICE_INCREASE_CONSENT_REQUIRED, PRICE_INCREASE_CONSENT_APPROVED | A price increase needs, or got, the customer's consent before the subscription renews at the new price. | No access change; skip the re-read. | |
VIRTUAL_CURRENCY_TRANSACTION | An in app currency balance changed. source says why (a purchase, an API call, the SDK, an expiration, or an ad reward). | No access change; skip the re-read. If you mirror balances, update them here, and only here, for products RevenueCat in app currency manages. | |
INVOICE_ISSUANCE | RevenueCat Billing only. An unpaid invoice was issued. | No access change; skip the re-read. | |
EXPERIMENT_ENROLLMENT | The customer was enrolled in an experiment. | No access change; skip the re-read. | |
TEST | A test event sent from the dashboard, carrying a sample purchase payload. | Return 200 and change nothing; skip the re-read. |
Key decisions baked into this table:
CANCELLATIONis not an access change on its own. AfterUNSUBSCRIBEorPRICE_INCREASEthe user keeps access untilexpiration_at_ms; revoking now deletes paid access the user still owns. AfterCUSTOMER_SUPPORT(a refund) access usually ends now, but a refund does not always cancel the subscription and auto renew can stay on.DEVELOPER_INITIATEDis a developer cancel through the store, which normally keeps access until expiry, or a removed granted entitlement, which ends access at once. The re-read settles each case.EXPIRATIONusually means access ended, but apply it through the re-read: a retriedEXPIRATIONcan arrive after a resubscription, and a granted entitlement or another store can still grant the same entitlement.- A resubscription after an
EXPIRATIONcan arrive asINITIAL_PURCHASE(usual on Google Play) orRENEWAL. A handler that only extends existing access onRENEWALleaves the resubscribed user locked out; the re-read grants access on either. BILLING_ISSUEis not revocation. Revoking onBILLING_ISSUE, or on theCANCELLATIONwithcancel_reasonBILLING_ERRORthat fires alongside it, cuts off users who are still inside a Google Play grace period. Users in account hold already lost access through theEXPIRATIONthat RevenueCat sends when grace ends.- A purchase made before login arrives under an anonymous
app_user_idthat matches none of your users, and thelogInmerge that follows sends no webhook (SUBSCRIBER_ALIASis not sent to new projects). Re-read the customer once the app'sPurchases.logIncall has returned, for example from an endpoint the app calls right after it; a re-read inside your own login endpoint runs before that merge. That endpoint re-reads only the signed in user's own ID, never an ID from the request, and is throttled per user like the serve time re-read.
Phase 3: Execute
Wire up a handler that authenticates, deduplicates, and dispatches.
Authenticate and parse
RevenueCat sends the authorization header value you set on the webhook integration with every request. Check it on every request. HMAC signing is optional and adds a second check: when it is on, each delivery also carries X-RevenueCat-Webhook-Signature: t=<unix_timestamp>,v1=<hmac_sha256_hex>, an HMAC-SHA256 of "<t>.<raw body>" keyed with the integration's signing secret. RevenueCat recomputes t and v1 on every delivery attempt, retries included.
Call revenueCatWebhook() from your Ktor module at startup.
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingrevenuecat-play-billing/skills/rc-webhooks/SKILL.md
Popularity
- Repository stars
- 73
- Repository forks
- 9
- 7-day trend score
- 27
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/revenuecat/ai-toolkit/rc-webhooks)