Payment integration with complete createOrder → captureOrder flow using React (Vite) and Express (ES Modules).
$12.00 → PayPal → Order: 9HE24829238191009 → CAPTURED
Request received: { amount: '12.00', currency: 'USD' }
Order created: 9HE24829238191009
Capture request: 9HE24829238191009
Payment captured: 9HE24829238191009
cd backend npm install cp .env.example .env
Add PayPal Sandbox credentials npm start
cd frontend npm install npm run dev
PayPal → “Pay with Debit or Credit Card” Card: 371449635398431 Expiry: 12/28 CVV: 1234 Country: United States
Login: Your USA Personal Sandbox Account Balance: $5000 fake USD
| Role | Country | Description |
|---|---|---|
| Buyer (Personal) | USA 🇺🇸 | Logs in / Uses card |
| Seller (Business) | India 🇮🇳 | Backend credentials (.env) |
| Payment | USD 💵 | Cross-border sandbox transaction |
This implementation demonstrates payment integration fundamentals that translate directly to other payment providers:
Adaptable to:
- Razorpay - Indian payments (UPI, Cards, NetBanking) → SDK Docs
- Stripe - Global payments with excellent developer experience → SDK Docs
Core concepts remain identical:
// Same 2-step flow across all gateways:
- Create Order/Payment Intent (backend)
- Capture/Confirm Payment (after user approval)
The architecture, security patterns (CORS, .env), and error handling demonstrated here apply universally across payment SDKs.