A Node.js backend API for handling Stripe payments with BBPOS WisePOS E device integration. This server provides endpoints for donation processing and payment verification.
- Payment intent creation for card-present transactions
- Payment capture and verification
- Webhook handling for real-time payment status updates
- Secure environment configuration
- CORS and security middleware integration
- Node.js (v14 or higher)
- Stripe account with API keys
- BBPOS WisePOS E device
- Clone the repository
- Install dependencies:
npm install
- Copy
.env.example
to.env
and update with your Stripe API keys:STRIPE_SECRET_KEY=your_stripe_secret_key_here STRIPE_WEBHOOK_SECRET=your_stripe_webhook_secret_here
- POST
/api/payments/create-payment-intent
- Body:
{ "amount": number, "currency": string }
- POST
/api/payments/capture-payment/:paymentIntentId
- POST
/api/payments/cancel-payment/:paymentIntentId
- POST
/api/payments/webhook
- Handles Stripe webhook events for payment status updates
Start the development server:
npm run dev
For production:
npm start
- Uses helmet for enhanced API security
- CORS configuration for allowed origins
- Environment variables for sensitive data
- Request validation and error handling
The API implements centralized error handling with appropriate HTTP status codes and error messages. In development mode, detailed error information is provided.