Bolt integration

PayPal Payment Integration Errors in Bolt App

Your Bolt.new application's PayPal integration fails at various stages: the PayPal button doesn't render, orders fail to create, or payments are captured but never confirmed. Users see 'Something went wrong' messages, empty payment popups, or get charged without the order being recorded in your system.

PayPal integration involves multiple steps - loading the SDK, creating orders, capturing payments, and handling webhooks - and Bolt's AI-generated code often gets one or more steps wrong. The PayPal popup may flash and close immediately, or payments may succeed on PayPal's side but fail to record in your database.

This is particularly dangerous when payments are captured by PayPal but your app doesn't record the transaction, leaving you with money collected and no order created. The customer paid but got nothing, requiring manual refunds and damaging trust.

Error Messages You Might See

Error: Client Authentication failed PayPal SDK: Invalid client-id Order creation failed: INVALID_RESOURCE_ID CAPTURE_ERROR: Order cannot be captured PAYER_ACTION_REQUIRED: Buyer must approve payment Webhook signature verification failed
Error: Client Authentication failedPayPal SDK: Invalid client-idOrder creation failed: INVALID_RESOURCE_IDCAPTURE_ERROR: Order cannot be capturedPAYER_ACTION_REQUIRED: Buyer must approve paymentWebhook signature verification failed

Common Causes

  • Sandbox vs live credentials mismatch — Using sandbox client ID in production or live credentials in development, causing all transactions to fail
  • PayPal SDK loaded with wrong client ID — The script tag loads the PayPal SDK with an undefined or incorrect client-id parameter
  • Order creation returns invalid response — The createOrder callback doesn't return the order ID in the format PayPal expects
  • Payment captured but not recorded — The onApprove handler captures the payment but fails to save the transaction to your database
  • Currency mismatch — Order created with one currency but the PayPal account is configured for a different currency
  • Webhook not configured — PayPal sends payment confirmation webhooks but your app has no endpoint to receive them

How to Fix It

  1. Verify credentials match environment — Use sandbox credentials (sb-...) for development and live credentials for production. Store them in environment variables and never mix them
  2. Load SDK correctly — Add the PayPal script with your client ID: <script src="https://www.paypal.com/sdk/js?client-id=${PAYPAL_CLIENT_ID}¤cy=USD"> and verify it loads without console errors
  3. Return order ID from createOrder — The createOrder function must return the order ID string: createOrder: async () => { const res = await fetch('/api/paypal/create-order'); const data = await res.json(); return data.id; }
  4. Record transaction in onApprove — After capturing payment, save to your database before showing success: onApprove: async (data) => { const capture = await fetch('/api/paypal/capture', { body: JSON.stringify({ orderId: data.orderID }) }); if (capture.ok) showSuccess(); }
  5. Set up webhooks for reliability — Configure PayPal webhooks in the developer dashboard to send PAYMENT.CAPTURE.COMPLETED events to your /api/paypal/webhook endpoint as a backup confirmation

Real developers can help you.

Mehdi Ben Haddou Mehdi Ben Haddou - Founder of Chessigma (1M+ users) & many small projects - ex Founding Engineer @Uplane (YC F25) - ex Software Engineer @Amazon and @Booking.com Anthony Akpan Anthony Akpan Developer with 8 years of experience building softwares fro startups PawelPloszaj PawelPloszaj I'm fronted developer with 10+ years of experience with big projects. I have small backend background too ISHANTDEEP SINGH ISHANTDEEP SINGH Senior Software Engineer with 7+ years of experience in React, JavaScript, TypeScript, Next.js, and Node.js. I’ve also worked as a tech lead for startups, owning end-to-end technical execution including architecture, development, scaling, and delivery. I bring a strong mix of hands-on coding, product thinking, and technical leadership, and I’m comfortable building products from scratch as well as improving and scaling existing systems. David Olverson David Olverson Solo dev shipping production apps with AI-assisted development. I specialize in rescuing broken Lovable/Bolt/Cursor builds and taking them to production. 10+ apps shipped including SaaS CRMs, gaming platforms, real estate tools, and Discord bots. Stack: Next.js 16, TypeScript, Tailwind CSS, FastAPI, PostgreSQL, Prisma. I use Claude Code with 50+ custom skills for rapid delivery. Average turnaround: 2-4 weeks from broken prototype to production. Vlad Temian Vlad Temian 15+ years shipping production infrastructure for startups. Former CTO at qed.builders (acquired by The Sandbox). Cursor ambassador and agentic tooling builder. I've scaled systems, automated deployments, and built observability tools for AI coding workflows. I specialize in taking vibe-coded apps from broken prototype to production-ready: fixing Supabase auth/RLS, Stripe integrations, deployment pipelines, and cleaning up AI-generated spaghetti. I build tools in this space (agentprobe, claudebin, micode) and understand both sides: how AI generates code and why it breaks. https://blog.vtemian.com/ Pratik Pratik SWE with 15+ years of experience building and maintaining web apps and extensive BE infrastructure Meïr Ankri Meïr Ankri Full-stack developer specializing in React / Next.js / Node.js with 6+ years of experience. I've worked across various sectors including automotive (Reezocar/Société Générale), healthcare (Medical Link SaaS), and e-commerce (Glasman). I build web apps end-to-end, from architecture to production, with a focus on scalability, performance, and code quality. I also mentor junior developers and contribute to technical decisions and code reviews. Tejas Chokhawala Tejas Chokhawala Full-stack engineer with 5 years experience building production web apps using React, Next.js and TypeScript. Focused on performance, clean architecture and shipping fast. Experienced with Supabase/Postgres backends, Stripe billing, and building AI-assisted developer tools. Daniel Vázquez Daniel Vázquez Software Engineer with over 10 years of experience on Startups, Government, big tech industry & consulting.

You don't need to be technical. Just describe what's wrong and a verified developer will handle the rest.

Get Help

Frequently Asked Questions

How do I switch from PayPal sandbox to live?

In PayPal Developer Dashboard, create a live app under 'Live' tab to get production credentials. Replace your sandbox client ID and secret with the live ones. Update your environment variables and test with a real PayPal account before launching.

Why does the PayPal popup open and close immediately?

This usually means the createOrder function is throwing an error or not returning a valid order ID. Open browser DevTools console before clicking the PayPal button to see the error. Common causes: wrong API endpoint, missing client ID, or the createOrder function returning undefined instead of the order ID string.

Related Bolt Issues

Can't fix it yourself?
Real developers can help.

You don't need to be technical. Just describe what's wrong and a verified developer will handle the rest.

Get Help