hcengineering/platform · critical
Failed to create subscription at provider
Error message
Failed to create subscription at provider
What it means
This 500 is returned when provider.createSubscription(...) throws while creating the checkout/subscription with the external payment provider (e.g. Stripe/Paddle). The error is logged server-side with ctx.error and a sanitized generic message is returned to the client. It wraps any provider-side failure: network errors, invalid API keys, rejected plans, or provider API errors.
Source
Thrown at services/payment/pod-payment/src/server.ts:243
if (request.type === undefined || request.plan === undefined) {
res.status(400).json({ error: 'Missing required fields: type, plan' })
return
}
let createSubResponse: CheckoutResponse
try {
createSubResponse = await provider.createSubscription(
ctx,
request,
workspaceUuid,
loginInfo.workspaceUrl,
accountUuid
)
} catch (err) {
ctx.error('Failed to create subscription at provider', { err })
res.status(500).json({ error: 'Failed to create subscription at provider' })
return
}
res.status(200).json(createSubResponse)
},
req,
res,
() => {}
)
}
)
/**
* POST /api/v1/subscriptions/:subscriptionId/cancel
* Cancel a subscription
* Authorization: Only workspace owner/admin can cancel
*/
app.post(View on GitHub (pinned to 63e28dc964)
Solutions
- Check the server logs for the ctx.error entry labeled 'Failed to create subscription at provider' to see the underlying provider error.
- Verify payment provider credentials/env vars (API keys, webhook secret) are present and valid in this deployment.
- Confirm the requested plan exists in the provider dashboard and matches the provider's plan/price ID mapping.
- Retry after confirming the provider status page shows no incident; add retry/backoff around provider calls for transient failures.
- If the provider SDK throws on auth, rotate the API key and redeploy.
Example fix
// before (stale key) PAYMENT_PROVIDER_API_KEY=sk_live_old // -> 500 Failed to create subscription at provider // after PAYMENT_PROVIDER_API_KEY=sk_live_current // redeploy; request succeeds with 200 CheckoutResponse
Defensive patterns
Strategy: retry
Validate before calling
// pre-flight: verify provider is reachable and credentials work
const ok = await provider.verifyConnection?.() // or a lightweight provider API call
if (!ok) throw new Error('Payment provider unreachable or credentials invalid; aborting subscribe') Type guard
function isProviderError(err: unknown): err is Error & { code?: string; providerStatus?: number } {
return err instanceof Error
} Try / catch
try {
const checkout = await subscribe(payload)
} catch (e) {
if (e instanceof HttpError && e.status === 500 && e.message === 'Failed to create subscription at provider') {
// inspect server logs / provider status, then retry with exponential backoff (max 3)
} else throw e
} Prevention
- Monitor provider status pages and add alerts for provider API error rates.
- Rotate and validate provider API keys in CI before deploys.
- Keep plan/price ID mappings in sync with the provider dashboard.
- Implement idempotent retries with backoff around provider calls.
When it happens
Trigger: POST /api/v1/subscriptions/:workspace/subscribe passing all local validation (token, loginInfo.workspaceUrl, type, plan) but the configured payment provider throws during createSubscription — e.g. unknown plan ID, provider API key invalid/expired, provider outage, or network failure to the provider.
Common situations: Rotated or missing provider API credentials in the environment; plan name in the request not existing in the provider's catalog; provider sandbox vs production mismatch; transient provider downtime; expired payment-provider access token.
Related errors
- Failed to cancel subscription at provider
- Failed to uncancel subscription at provider
- "npm view" returned error code ${npmVersionSpawnResult.statu
- Unable to resolve version ${version} of package ${name}: ${e
- response.statusText
AI-assisted analysis of hcengineering/platform@63e28dc964 (2026-08-29).
Data as JSON: /api/errors/b85526a06d8e7de7.
Report an issue: GitHub.