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.

Sage Fulcher Sage Fulcher Hey I'm Sage! Im a Boston area software engineer who grew up in South Florida. Ive worked at a ton of cool places like a telehealth kidney care startup that took part in a billion dollar merger (Cricket health/Interwell health), a boutique design agency where I got to work on a ton of exciting startups including a photography education app, a collegiate Esports league and more (Philosophie), a data analytics as a service startup in Cambridge (MA) as well as at Phillips and MIT Lincoln Lab where I designed and developed novel network security visualizations and analytics. I've been writing code and furiously devoted to using computers to make people’s lives easier for about 17 years. My degree is in making computers make pretty lights and sounds. Outside of work I love hip hop, the Celtics, professional wrestling, magic the gathering, photography, drumming, and guitars (both making and playing them) 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. Yovel Cohen Yovel Cohen I got a lot of experience in building Long-horizon AI Agents in production, Backend apps that scale to millions of users and frontend knowledge as well. Krishna Sai Kuncha Krishna Sai Kuncha Experienced Professional Full stack Developer with 8+ years of experience across react, python, js, ts, golang and react-native. Developed inhouse websearch tooling for AI before websearch was solved : ) Simon A. Simon A. I'm a backend developer building APIs, emulators, and interactive game systems. Professionally, I've developed Java/Spring reporting solutions, managed relational and NoSQL databases, and implemented CI/CD workflows. Jared Hasson Jared Hasson Full time lead founding dev at a cyber security saas startup, with 10 yoe and a bachelor's in CS. Building & debugging software products is what I've spent my time on for forever AUXLE AUXLE I am a Full Stack Developer experienced in building Websites, Web apps and Cross Platform Mobile Apps for Startups and Companies. Basel Issmail Basel Issmail ’m a Senior Full-Stack Developer and Tech Lead with experience designing and building scalable web platforms. I work across the full development lifecycle, from translating business requirements into technical architecture to delivering reliable production systems. My work focuses on modern web technologies, including TypeScript, Angular, Node.js, and cloud-based architectures. I enjoy solving complex technical problems and helping teams turn product ideas and prototypes into working platforms that can grow and scale. In addition to development, I often collaborate closely with product managers, business analysts, designers, and QA teams to ensure that solutions align with both technical and business goals. I enjoy working with startups and product teams where I can contribute both as a hands-on engineer and as a technical partner in designing and delivering impactful software. 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. hanson1014 hanson1014 Full-stack developer experienced in fixing and deploying AI-generated apps from Lovable, Bolt.new, Cursor, and Replit. I specialize in debugging Supabase integration issues (auth flows, RLS policies, database connections), fixing broken deployments, resolving routing/blank screen problems, and cleaning up messy React/Vite codebases. I also build production apps with the Claude API and have shipped a Mac desktop dev tool (Nexterm from scratch. Based in Hong Kong, fast turnaround.

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