Skip to content

Test mode

Test mode runs the whole chain (recording, event, signed webhook, event log) without an ad SDK or ad network. It is off by default.

Terminal window
npx @kasskeep/cli ads test-enable --id app_xxx

With testAds the SDK calls the test endpoint instead of your provider:

Kasskeep.configure({ apiKey, baseUrl, appUserId, ads: { rewardedProvider, adUnits, testAds: __DEV__ } });
const r = await Kasskeep.ads.showRewarded({ adUnit: "revive", customData: "stage=3", testOutcome: "completed" });

The underlying call, with the public key:

POST /v1/ads/test/rewards
X-Kasskeep-Key: pk_...
{"app_user_id": "6f1c...", "ad_unit": "revive", "reward_type": "coins", "reward_amount": 10, "custom_data": "stage=3", "outcome": "completed"}
  • outcome: completed (default), skipped or failed. Only completed creates an ad.reward.
  • network (optional): test by default. With admob, applovin or levelplay the reward takes that network’s shape and mapped ad unit id. Other values return 400 unknown_ad_network.
  • Events have environment: "test" and platform: "test"; transaction ids start with testad_.
  • With the default reject policy the ad unit name must be mapped (for that network when network is set), otherwise 422 unknown_ad_unit.
  • While test ads are off: 403 test_ads_disabled.

The response is {status, reward_event_id, ad_reward}.

Terminal window
npx @kasskeep/cli ads simulate --id app_xxx --user <app_user_id> --ad-unit revive --reward-amount 10 --transaction-id replay-1 --network levelplay

Run it twice with the same --transaction-id to see deduplication.

Turning on test ads, like the test store, also lets http://localhost:* origins through CORS.