Payment Config Reference
This page summarizes the environment variable naming conventions and product ID mappings for each payment provider.
When Product IDs Are Required
Whether you need to create products on each payment platform and configure environment variables depends on the pricing mode:
| Pricing Mode | Stripe | Creem | PayPal | Alipay |
|---|---|---|---|---|
| Credits | Yes | Yes | No | No |
| Unlimited Subscription | Yes | Yes | Yes | No |
| Quota Subscription | Yes | Yes | Yes | No |
| Lifetime | Yes | Yes | No | No |
- Stripe / Creem — All modes require creating products on the platform and configuring product IDs in environment variables
- PayPal — Only subscription modes require creating Plans. Credits and Lifetime use PayPal's native orders and don't need pre-created products
- Alipay — No modes require pre-created products. Amounts are passed dynamically by code
Environment Variable Naming Convention
All payment provider product IDs follow a unified naming convention. The system automatically reads the corresponding environment variables based on the keys in config/payment.ts.
Subscription Products
Format: {PROVIDER}_SUB_{PLAN}_{CYCLE}
# Stripe
STRIPE_SUB_BASIC_MONTHLY=price_xxx
STRIPE_SUB_BASIC_YEARLY=price_xxx
STRIPE_SUB_PRO_MONTHLY=price_xxx
STRIPE_SUB_PRO_YEARLY=price_xxx
# PayPal
PAYPAL_SUB_BASIC_MONTHLY=P-xxx
PAYPAL_SUB_BASIC_YEARLY=P-xxx
PAYPAL_SUB_PRO_MONTHLY=P-xxx
PAYPAL_SUB_PRO_YEARLY=P-xxx
# Creem
CREEM_SUB_BASIC_MONTHLY=prod_xxx
CREEM_SUB_BASIC_YEARLY=prod_xxx
CREEM_SUB_PRO_MONTHLY=prod_xxx
CREEM_SUB_PRO_YEARLY=prod_xxxBASIC, PRO, MAX, ULTRA correspond to the fixed keys in SUBSCRIPTION_PLANS (uppercase). Configure only the plans you need.
Credits Package Products
Format: {PROVIDER}_CREDITS_{TYPE}
# Stripe
STRIPE_CREDITS_BASIC=price_xxx
STRIPE_CREDITS_PRO=price_xxx
STRIPE_CREDITS_MAX=price_xxx
# Creem
CREEM_CREDITS_BASIC=prod_xxx
CREEM_CREDITS_PRO=prod_xxx
CREEM_CREDITS_MAX=prod_xxxBASIC, PRO, MAX, ULTRA correspond to the fixed keys in PACKAGES (uppercase). Configure as needed.
Lifetime Products
Format: {PROVIDER}_LIFETIME_{PLAN}
# Stripe
STRIPE_LIFETIME_STANDARD=price_xxx
STRIPE_LIFETIME_EXCLUSIVE=price_xxx
# Creem
CREEM_LIFETIME_STANDARD=prod_xxx
CREEM_LIFETIME_EXCLUSIVE=prod_xxx
# PayPal
PAYPAL_LIFETIME_STANDARD=xxx
PAYPAL_LIFETIME_EXCLUSIVE=xxxSTANDARD, EXCLUSIVE, ULTIMATE correspond to the fixed keys in LIFETIME_PLANS (uppercase). Configure as needed.
No-Trial Variants (Creem / PayPal)
Stripe controls trial periods via API parameters and doesn't need extra products. But Creem and PayPal are different — trial periods are bound to the product/plan at creation time. So you need to create two products for the same plan: one with trial and one without.
The system automatically determines: users who have already trialed will use the no-trial product ID at checkout, preventing repeated free trials.
# Creem no-trial
CREEM_SUB_NOTRIAL_PRO_MONTHLY=prod_xxx
CREEM_SUB_NOTRIAL_PRO_YEARLY=prod_xxx
# PayPal no-trial
PAYPAL_SUB_NOTRIAL_PRO_MONTHLY=P-xxx
PAYPAL_SUB_NOTRIAL_PRO_YEARLY=P-xxxIf no-trial variants are not configured, the system falls back to the trial-enabled version.
Provider Base Configuration
Stripe
STRIPE_API_KEY=sk_test_xxx
STRIPE_WEBHOOK_SECRET=whsec_xxxPayPal
NEXT_PUBLIC_PAYPAL_CLIENT_ID=xxx
PAYPAL_SECRET=xxx
PAYPAL_WEBHOOK_ID=xxx
PAYPAL_MODE=sandbox # sandbox or liveCreem
CREEM_API_KEY=creem_test_xxx # creem_test_ prefix automatically uses test environment
CREEM_WEBHOOK_SECRET=xxxAlipay
ALIPAY_APP_ID=xxx
ALIPAY_PRIVATE_KEY=xxx
ALIPAY_APP_CERT=xxx # App public key certificate content
ALIPAY_PUBLIC_CERT=xxx # Alipay public key certificate content
ALIPAY_ROOT_CERT=xxx # Alipay root certificate content
ALIPAY_GATEWAY=https://openapi.alipay.com/gateway.doEnabling Payment Providers
NEXT_PUBLIC_PAYMENT_PROVIDERS=paypal,creem,stripeSeparate multiple providers with commas. The pricing page will automatically display the providers you've enabled. This variable must be configured manually — no payment providers are enabled by default.
Which providers should I enable? We recommend showing only one primary payment button to reduce choice overload and boost conversion. Use Stripe (if you have an overseas entity) or Creem as your primary, and keep PayPal as a fallback. Read more in The Best Way to Display Payment Options.
Mapping Overview
The system automatically maps environment variables to product IDs in lib/payment/config.ts. You don't need to modify this file — just configure your environment variables following the naming convention and the system will find the corresponding products.
config/payment.ts key → environment variable → payment provider product IDFor example: SUBSCRIPTION_PLANS.pro + Stripe + monthly → reads STRIPE_SUB_PRO_MONTHLY → gets the Stripe Price ID.