Skip to content

Commit 01339c3

Browse files
committed
feat(billing): configure Polar product ids for Pro + Premium (unblock paid checkout)
- Add POLAR_PRODUCT_ID_{PRO,PREMIUM,ULTRA,MAX} (optional) to the strict gateway env schema so the vars pass validation. - Bind real Pro + Premium product ids as non-secret wrangler vars (read from the Polar dashboard). Ultra/Max have no Polar product yet — those tiers 503 until created.
1 parent 840bd54 commit 01339c3

2 files changed

Lines changed: 13 additions & 0 deletions

File tree

apps/gateway-worker/wrangler.jsonc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,13 @@
66
"main": "src/index.ts",
77
"compatibility_date": "2026-05-20",
88
"compatibility_flags": ["nodejs_compat"],
9+
// Polar product ids per paid tier — non-secret config (they appear in checkout URLs),
10+
// bound as plain vars. Ultra/Max have no Polar product yet, so those tiers 503 until
11+
// the owner creates the products and adds their ids here.
12+
"vars": {
13+
"POLAR_PRODUCT_ID_PRO": "c76a8fa5-ac08-4333-9cee-aa7a8a3d959c",
14+
"POLAR_PRODUCT_ID_PREMIUM": "11e9b294-73e0-47f6-943c-314e53b63e6e"
15+
},
916
"routes": [
1017
{
1118
"pattern": "gateway.trycheatcode.com/*",

packages/env/src/worker.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,12 @@ export const GatewayWorkerEnvSchema = z
4848
IDEMPOTENCY: z.custom<DurableObjectNamespace>().optional(),
4949
INTERNAL_MAINTENANCE_SECRET: OptionalWorkerSecretSchema,
5050
POLAR_ACCESS_TOKEN: OptionalWorkerSecretSchema,
51+
// Polar product ids per paid tier — non-secret config bound as plain wrangler vars
52+
// (not secrets). Optional so a tier without a Polar product simply 503s on checkout.
53+
POLAR_PRODUCT_ID_PRO: z.string().min(1).optional(),
54+
POLAR_PRODUCT_ID_PREMIUM: z.string().min(1).optional(),
55+
POLAR_PRODUCT_ID_ULTRA: z.string().min(1).optional(),
56+
POLAR_PRODUCT_ID_MAX: z.string().min(1).optional(),
5157
QUOTA_TRACKER: z.custom<DurableObjectNamespace>(),
5258
RATE_LIMITER: z.custom<DurableObjectNamespace>(),
5359
})

0 commit comments

Comments
 (0)