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.

Anthony Akpan Anthony Akpan Developer with 8 years of experience building softwares fro startups Milan Surelia Milan Surelia Milan Surelia is a Mobile App Developer with 5+ years of experience crafting scalable, cross-platform apps at 7Span and Meticha. At 7Span, he engineers feature-rich Flutter apps with smooth performance and modern UI. As the Co-Founder of Meticha, he builds open-source tools and developer-focused products that solve real-world problems. Expertise: 💡 Developing cross-platform apps using Flutter, Dart, and Jetpack Compose for Android, iOS, and Web. 🖋️ Sharing insights through technical writing, blogging, and open-source contributions. 🤝 Collaborating closely with designers, PMs, and developers to build seamless mobile experiences. Notable Achievements: 🎯 Revamped the Vepaar app into Vepaar Store & CRM with a 2x performance boost and smoother UX. 🚀 Launched Compose101 — a Jetpack Compose starter kit to speed up Android development. 🌟 Open source contributions on Github & StackOverflow for Flutter & Dart 🎖️ Worked on improving app performance and user experience with smart solutions. Milan is always happy to connect, work on new ideas, and explore the latest in technology. 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. Stanislav Prigodich Stanislav Prigodich 15+ years building iOS and web apps at startups and enterprise companies. I want to use that experience to help builders ship real products - when something breaks, I'm here to fix it. 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. 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 : ) Matthew Butler Matthew Butler Systems Development Engineer @ Amazon Web Services Antriksh Narang Antriksh Narang 5 years+ Experienced Dev (Specially in Web Development), can help in python, javascript, react, next.js and full stack web dev technologies. Costea Adrian Costea Adrian Embedded Engineer specilizing in perception systems. Latest project was a adas camera calibration system.

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