A backend server for a cryptocurrency onramp service using Stripe for payment processing.
- Accepts payments via Stripe Checkout
- Calculates service fees (0.5%) and Stripe fees
- Provides API endpoints for creating checkout sessions and verifying payments
- Maximum onramp amount of $2,500
POST /api/create-checkout- Create a Stripe checkout sessionGET /api/verify-session- Verify a Stripe session after payment completes
- Node.js (v14 or later)
- npm
- Stripe account and API key
Create a .env file in the root directory with the following:
VITE_STRIPE_SECRET_KEY=your_stripe_secret_key
- Clone the repository:
git clone https://github.com/yourusername/hyperramp-backend.git
cd hyperramp-backend- Install dependencies:
npm install- Build the project:
npm run buildRun the development server with hot reloading:
npm run devThe server will run on port 3000 by default.
Build and start the production server:
npm run build
npm start// Example frontend code
const response = await fetch('http://localhost:3000/api/create-checkout', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({ amount: 100 }), // Amount in USD
});
const { url } = await response.json();
window.location.href = url; // Redirect to Stripe Checkout// Example frontend code
const response = await fetch(`http://localhost:3000/api/verify-session?id=${sessionId}`);
const session = await response.json();ISC