GameChanger

Connect RevenueCat

GameChanger assigns one code from your pool when a subscriber converts, renews, upgrades, or refers someone. RevenueCat calls a webhook. Braze, OneSignal, or the public API delivers the code. No app update is required for the messaging path.

Before the webhook

  1. Sign in and create a project for the app.
  2. Upload codes. A line can be the code alone, or CODE,25,2027-12-31. The dollar value selects the pool.
  3. Add an offer for the event you care about, and approve a monthly cap. Until the cap is approved, codes are held and not delivered.
  4. Optional: connect Braze or OneSignal in Settings, and paste a RevenueCat secret API key if the issued code should be stored on the subscriber as reward_code.

Webhook

In the RevenueCat dashboard, add a webhook. The URL is shown on the project overview:

https://YOUR_APP/api/webhooks/revenuecat/PROJECT_ID

Set the authorization header to Bearer plus the project webhook secret from the same page. X-Webhook-Secret is also accepted. There is no shared environment variable for this secret. Each project has its own.

The same subscriber and transaction always receive the same code. A retried or resent webhook does not claim a second one.

Events

  • INITIAL_PURCHASE with period_type other than TRIAL matches an Initial purchase offer.
  • INITIAL_PURCHASE with period_type TRIAL does not assign a code.
  • RENEWAL with is_trial_conversion: true matches a Trial converted offer.
  • RENEWAL without that flag matches a Renewal offer. Set a renewal number, or leave it blank for any renewal.
  • PRODUCT_CHANGE matches a Product change offer. List product ids to limit it.
  • REFUND, or CANCELLATION with cancel_reason CUSTOMER_SUPPORT, voids the code for that transaction.
  • CANCELLATION with UNSUBSCRIBE does not void a code. The subscriber still has the period they paid for.
  • Sandbox events are ignored unless the project is in test mode. Test mode does not bill.

Check a deployment

With the app running and DATABASE_URL pointed at its database:

node scripts/simulate-revenuecat.mjs \
  --base-url https://YOUR_APP \
  --seed

--seed creates a project, four codes, an Initial purchase offer, and a Trial converted offer. The script then sends a paid purchase, retries it, sends a trial start, sends the trial-conversion renewal, and refunds the paid purchase. It expects one code claimed, the retry ignored, the trial start ignored, the conversion claimed, and the refund voided. The public reward API hides the voided code and still returns the conversion code.

To hit a project you already created, omit --seed and pass --project-id, --webhook-secret, and --api-key from the project settings. That project needs both offers, codes in the $25 pool, and an approved cap.

Sample purchase

curl -X POST https://YOUR_APP/api/webhooks/revenuecat/PROJECT_ID \
  -H "Authorization: Bearer WEBHOOK_SECRET" \
  -H "Content-Type: application/json" \
  -d '{
    "event": {
      "id": "evt_1",
      "type": "INITIAL_PURCHASE",
      "app_user_id": "user_1",
      "transaction_id": "txn_1",
      "original_transaction_id": "txn_1",
      "period_type": "NORMAL",
      "environment": "PRODUCTION",
      "product_id": "monthly"
    }
  }'

A successful delivery returns { "outcome": "sent" }. The activity page lists the code. GET /api/v1/rewards/current?app_user_id=user_1 with Authorization: Bearer PROJECT_API_KEY returns the label, code, and redeem URL.

You pay per code sent, with a monthly cap you approve. Held codes and codes voided before delivery are not billed. Back to the overview.