Per-product credential storage
Each uncle-z product manages its own credentials. The gateway operator hands out (public_key, secret, webhook_secret) triples per app; PSP-side credentials (Polar OATs, etc.) you manage on your side.
Gateway app credentials
Section titled “Gateway app credentials”Per app, three values, generated at provisioning time:
public_key: pk_<24 hex chars>secret: <64 hex chars>webhook_secret: <64 hex chars>Typical pattern: two apps per product (sandbox + live), so you carry six secrets total. Store them outside the repo:
# .env (gitignored, deployment-specific)PAYMENT_GATEWAY_URL=https://payment.uncle-z.comPAYMENT_GATEWAY_PUBLIC_KEY=pk_xxxPAYMENT_GATEWAY_SECRET=xxxPAYMENT_GATEWAY_WEBHOOK_SECRET=xxxRotation: not in-place today. If a secret is compromised, the operator archives the app and provisions a new one. You swap the env, restart, done.
Polar OATs (only if your product hits Polar)
Section titled “Polar OATs (only if your product hits Polar)”Per product, two OATs (sandbox + live), scoped narrow:
readeverythingwriteonlyproducts+custom_fields
Cannot issue charges, rotate webhook secrets, or modify org settings.
Store outside the repo:
~/.config/<product>/polar-oat-sandbox.txt # chmod 600~/.config/<product>/polar-oat-live.txt # chmod 600These tokens are only for product-side product CRUD — creating Polar products, updating prices, etc. They are NOT used at runtime. The gateway has its own runtime token (full scope) on the prod server; not your concern.
Don’t share OATs across products. Don’t commit them. Rotate at the issuing dashboard if you suspect compromise.
What you should NEVER store on the product side
Section titled “What you should NEVER store on the product side”- The gateway’s PSP credentials (
POLAR_*_ACCESS_TOKEN,NICEPAY_*_MERCHANT_KEY, etc.) — those live in the gateway’s prod env, not in any product. - The gateway’s webhook secrets for inbound (PSP→gateway) — those are PSP-side, owned by the operator.
- Other products’ app credentials — every product gets its own pair.
Setup checklist
Section titled “Setup checklist”When the operator hands you credentials for a new product:
- Receive:
public_key,secret,webhook_secretfor sandbox app + same for live app. - Receive: Polar product UUIDs for sandbox + live (per plan), if you’re a Polar product.
- Drop into your deployment env (production .env, Docker env, etc.).
- Implement request signing using
secret. - Implement webhook verification using
webhook_secret. - Smoke-test with sandbox creds against
payment.uncle-z.com(full E2E with real PSP sandbox). - Flip env to live creds when promoting to production.
The flip from sandbox to live in production is just an env swap + restart on your side — no gateway changes, no operator involvement.