Third-Party Payment Gateways
Connect Stripe or Omise to your app with your own API keys, stored as environment variables.
Prefer the built-in Payments (Beam Checkout, Stripe Connect). They need no keys. Use this page for other gateways, or a Stripe account you manage with your own keys.
Get test keys from the gateway's dashboard, then add them under Settings → Configuration → Environment Variables. See Environment Variables. Enter the secret keys yourself: your coding agent can create the non-secret variables, but it can't set a secret's value.
Variables
| Gateway | Key | Value | Secret |
|---|---|---|---|
| Stripe | NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY | pk_test_... | Off |
| Stripe | STRIPE_SECRET_KEY | sk_test_... | On |
| Stripe | STRIPE_WEBHOOK_SECRET | whsec_... | On |
| Omise | OMISE_PUBLIC_KEY | pkey_test_... | Off |
| Omise | OMISE_SECRET_KEY | skey_test_... | On |
- Target Sandbox while testing.
- Only
NEXT_PUBLIC_variables reach the browser. - Never expose a secret key in client code.
Prompts
Give your coding agent one of these, or Starcat Developer in the app's Build tab.
Stripe:
Add subscription billing using Stripe.
Requirements:
- Monthly and annual plans at $29/mo and $290/year
- Use NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY and STRIPE_SECRET_KEY
- Track payment status with Stripe webhooks verified by STRIPE_WEBHOOK_SECRET
- Update the user's subscription status in the databaseOmise:
Accept Thai Baht payments by card and PromptPay QR using Omise.
Requirements:
- Payment page with Credit Card and PromptPay options
- Use OMISE_PUBLIC_KEY and OMISE_SECRET_KEY
- Show the PromptPay QR code and wait for confirmation
- Store orders in the database with payment statusTest cards
| Gateway | Card | Result |
|---|---|---|
| Stripe | 4242 4242 4242 4242 | Succeeds |
| Stripe | 4000 0025 0000 3155 | Requires authentication |
| Stripe | 4000 0000 0000 9995 | Declined |
| Omise | 4242 4242 4242 4242 | Succeeds |
| Omise | 4111 1111 1111 1111 | Fails |
Stripe: any future expiry, any CVC. Omise: expiry 12/30, any CVV. Omise test PromptPay QR codes complete on their own after a few seconds. More in Stripe's testing docs and Omise's.
Webhook endpoints must return 200 OK quickly or the gateway retries.
Go live
- Get production keys from the gateway (needs business verification)
- Add them as new variables targeting Production
- Point the gateway's webhook URL at your production domain
- Test with a small real transaction