hcengineering/platform · critical · Error

Payment provider is not configured. Please provide payment p

Error message

Payment provider is not configured. Please provide payment provider configuration.

What it means

createServer assembles the payment service and initializes the payment provider (currently only Stripe) from configuration. If, after attempting initialization, the provider is still null — because no Stripe config (API key, webhook secret, subscription plans, front URL) was provided or Stripe init threw and was swallowed by the catch block — the server refuses to start and throws this error.

Source

Thrown at services/payment/pod-payment/src/server.ts:171

          frontUrl: config.FrontUrl
        },
        accountClient,
        false
      )

      if (provider !== undefined) {
        // Register provider-specific endpoints (e.g., webhooks)
        provider.registerWebhookEndpoints(app, ctx, config.AccountsUrl, serviceToken)

        ctx.info('Stripe payment provider initialized successfully')
      }
    } catch (err) {
      ctx.error('Failed to initialize payment provider Stripe', { err })
    }
  }

  if (provider == null) {
    throw new Error('Payment provider is not configured. Please provide payment provider configuration.')
  }

  const stopReconciliation = startActiveSubscriptionReconciliation(
    ctx,
    config.AccountsUrl,
    serviceToken,
    provider,
    config.ReconciliationIntervalMinutes ?? 60
  )

  // ============ Generic Payment Service Endpoints ============
  // These endpoints are provider-agnostic and work with any payment provider

  /**
   * POST /api/v1/subscriptions/:workspace/subscribe
   * Create a subscription for a workspace
   * Body: SubscribeRequest { type: 'tier' | 'support', plan: string, ... }
   */

View on GitHub (pinned to 63e28dc964)

Solutions

  1. Set the required Stripe configuration (API key, webhook secret, subscription plans, front URL) in the service environment and restart
  2. Check service logs for 'Failed to initialize payment provider Stripe' to see the underlying init error (bad key, missing plan config)
  3. Verify secrets are actually mounted/injected in your deployment (k8s secret, docker env file)
  4. Validate the subscriptionPlans string format: semicolon-separated 'plan@type:priceId' entries with all required plans present

Example fix

// before (env)
# STRIPE_API_KEY unset
STRIPE_WEBHOOK_SECRET=whsec_...
// after (env)
STRIPE_API_KEY=sk_live_...
STRIPE_WEBHOOK_SECRET=whsec_...
STRIPE_SUBSCRIPTION_PLANS=common@tier:price_abc;rare@tier:price_def;epic@tier:price_ghi;legendary@tier:price_jkl
Defensive patterns

Strategy: validation

Validate before calling

// run before starting the service
const required = ['STRIPE_API_KEY', 'STRIPE_WEBHOOK_SECRET', 'STRIPE_SUBSCRIPTION_PLANS', 'FrontUrl']
const missing = required.filter(k => !process.env[k])
if (missing.length > 0) {
  throw new Error(`Payment service misconfigured, missing env vars: ${missing.join(', ')}`)
}

Type guard

function hasStripeConfig(c: PaymentConfig | undefined): c is PaymentConfig & { Stripe: { apiKey: string; webhookSecret: string; subscriptionPlans: string } } {
  return c?.Stripe != null && !!c.Stripe.apiKey && !!c.Stripe.webhookSecret && !!c.Stripe.subscriptionPlans
}

Try / catch

try {
  const server = await createServer(ctx, config)
  // server: { app, close }
} catch (err) {
  if ((err as Error).message.includes('Payment provider is not configured')) {
    console.error('Payment service cannot start: Stripe configuration missing or invalid. Check env/secret injection.')
    process.exit(1) // fail fast; orchestration should alert
  }
  throw err
}

Prevention

When it happens

Trigger: Starting the payment service without the Stripe configuration variables set; Stripe init throwing (invalid API key, missing subscriptionPlans entries) and the catch block logging 'Failed to initialize payment provider Stripe' leaving provider null; config section for the provider absent entirely.

Common situations: Deploying without StripeApiKey/StripeSubscriptionPlans env vars; typos in env variable names in docker/k8s manifests; invalid Stripe API key or an incomplete subscriptionPlans string causing the constructor to fail; secret not mounted in the container.

Understand the failure class

Background: "environment variable is not set" and "Missing keys in environment" errors: what missing required env var messages mean and how to fix them — this error's family across 28 libraries.

Related errors


AI-assisted analysis of hcengineering/platform@63e28dc964 (2026-08-29). Data as JSON: /api/errors/8d453176626d390a. Report an issue: GitHub.