afterbuild/ops
ERR-929/stack trace
ERR-929
Replit Stripe integration broken — fix webhooks and payment state

Replit Stripe integration broken — fix webhooks and payment state

Last updated 17 April 2026 · 8 min read · By Hyder Shah
Direct answer

Scope of this page:Replit-specific Stripe issues — Replit URL rotation, Python/Flask raw-body handling, Replit deploy target. For the tool-agnostic error-signature fix see Stripe webhook not firing. Shopping for a paid engagement? Add payments to AI app.

Replit apps can integrate Stripe but Replit’s URL structure creates webhook configuration issues. The preview URL changes; the production Replit URL is not the same as your webhook endpoint. Additionally, Stripe webhook signature verification requires the raw request body— something that breaks when request parsing middleware runs first.

Quick fix for Replit Stripe integration broken — fix

Start here

Fix 1 — Configure production webhook URL in Stripe

In Stripe Dashboard → Developers → Webhooks → Add endpoint: enter your Replit production URL (not the preview URL):

https://yourapp.replit.app/api/webhook

Subscribe to: checkout.session.completed, invoice.paid, customer.subscription.updated, customer.subscription.deleted.

Deeper fixes when the quick fix fails

  1. 02

    Fix 2 — Preserve raw body for signature verification

    Express apps: add express.raw before express.json on the webhook route.

    // Before express.json middleware for this route only:
    app.post(
      '/api/webhook',
      express.raw({ type: 'application/json' }),
      async (req, res) => {
        const sig = req.headers['stripe-signature'];
        const event = stripe.webhooks.constructEvent(
          req.body,
          sig,
          process.env.STRIPE_WEBHOOK_SECRET
        );
        // handle event
      }
    );
    
    // All other routes still get JSON parsing:
    app.use(express.json());

    The webhook signature verification will fail if the body is parsed before it reaches the Stripe verification call.

  2. 03

    Fix 3 — Handle all subscription lifecycle events

    Most Replit Stripe integrations only handle checkout.session.completed. Add handlers for: invoice.paid (monthly renewal), customer.subscription.updated (plan change, trial end), customer.subscription.deleted (cancellation). Each one should update your database so paywalled routes know whether the user has an active subscription.

  3. 04

    Fix 4 — Add webhook secret to Replit Secrets

    In Replit Secrets tab: add STRIPE_WEBHOOK_SECRET with the signing secret from your Stripe webhook configuration (starts with whsec_). This is different from your Stripe API key (sk_live_ / sk_test_). Redeploy after adding.

Verify end-to-end

Stripe Dashboard → Developers → Webhooks → your endpoint → Send test webhook. Pick checkout.session.completed and send. The response should be 200 within 2 seconds. Then run a full test purchase (Stripe test card 4242 4242 4242 4242) and verify: (1) checkout opens, (2) payment succeeds, (3) webhook fires, (4) your database reflects the paid status, (5) the user gets access to paid routes.

Why AI-built apps hit Replit Stripe integration broken — fix

Replit Agent adds Stripe checkout but usually skips: (1) webhook endpoint configuration with Stripe, (2) raw body preservation for signature verification, (3) subscription state management in the database.

The most common failure mode: checkout works, payment succeeds in Stripe dashboard, but the app never activates the user’s subscription because the webhook is either never reaching your app or is rejected by signature verification.

Stripe payments go through but my app never activates the subscription.
Reddit — r/Replit

Diagnose Replit Stripe integration broken — fix by failure mode

Match your symptom to the failing layer. Most of these show up in Stripe’s own webhook dashboard.

SymptomCauseFix
Webhook shows 'Failed' in Stripe DashboardWebhook URL wrong or app unreachableFix 1
Webhook URL returns 400 'Invalid signature'Request body parsed before signature verificationFix 2
First payment works, renewals don't activateOnly checkout.session.completed handledFix 3
Webhook endpoint returns 500 'undefined secret'STRIPE_WEBHOOK_SECRET missing from SecretsFix 4

Related errors we fix

Still stuck with Replit Stripe integration broken — fix?

Emergency triage · $299 · 48h turnaround
We restore service and write the root-cause report.

Payments failing in production is a revenue emergency. We fix Stripe end-to-end with a verified test purchase:

  • Stripe Dashboard shows failed webhooks
  • Payments succeed but users don't get access
  • Subscription renewals don't extend access
  • You don't know the difference between test and live webhook secrets
start the triage →

Replit Stripe integration broken — fix questions

Why does my Stripe webhook say 'Invalid signature'?+
Either the webhook secret is wrong (verify you copied the one for this specific endpoint, not a different one), or the request body was parsed before signature verification. Express's express.json() middleware destroys the raw body Stripe needs to verify. Use express.raw({ type: 'application/json' }) on the webhook route only.
What webhook events do I need to handle for subscriptions?+
Minimum: checkout.session.completed (initial purchase), invoice.paid (monthly renewal), customer.subscription.updated (plan changes, trial ending), customer.subscription.deleted (cancellation). If you only handle checkout.session.completed, renewals won't activate and cancellations won't deactivate.
How do I test Stripe webhooks locally in Replit?+
Install Stripe CLI and run 'stripe listen --forward-to https://yourapp.replit.app/api/webhook'. It forwards real test events from your Stripe account to your Replit URL and prints signatures you can use. Don't try to test with the Send test webhook button in Dashboard — that doesn't test your full flow.
My webhook works with test keys but fails with live keys. What's wrong?+
Live mode has a separate webhook endpoint with a separate signing secret. In Stripe Dashboard, toggle 'View test data' off and re-check your webhook configuration. Create a new endpoint if needed. Update STRIPE_WEBHOOK_SECRET in Replit Secrets to the live endpoint's signing secret.
Can I use Stripe Checkout instead of Payment Elements?+
Yes, and it's simpler. Stripe Checkout is a hosted page — you create a session server-side, redirect the user to the Checkout URL, and handle the result via webhook. Replit Agent often generates this flow. The webhook configuration is the same either way; only the front-end differs.
How much does a Stripe integration fix cost?+
A single webhook + subscription-state fix runs $299 as Emergency Triage (48-hour turnaround, includes a full test purchase). A complete payment flow rebuild — checkout, webhooks, refunds, subscription lifecycle, receipts — starts at $799 as part of Integration Fix.
Next step

Ship the fix. Keep the fix.

Emergency Triage restores service in 48 hours. Break the Fix Loop rebuilds CI so this error cannot ship again.

About the author

Hyder Shah leads Afterbuild Labs, shipping production rescues for apps built in Lovable, Bolt.new, Cursor, Replit, v0, and Base44. our rescue methodology.

Replit Stripe integration broken — fix experts

If this problem keeps coming back, you probably need ongoing expertise in the underlying stack.

Sources