Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ulisses22/stripe-payment-in-nodejs
How to Integrate Stripe Payment Gateway in Node.js App
https://github.com/ulisses22/stripe-payment-in-nodejs
api backend javascript nodejs payment-gateway stripe
Last synced: 1 day ago
JSON representation
How to Integrate Stripe Payment Gateway in Node.js App
- Host: GitHub
- URL: https://github.com/ulisses22/stripe-payment-in-nodejs
- Owner: Ulisses22
- Created: 2024-04-26T02:02:22.000Z (8 months ago)
- Default Branch: main
- Last Pushed: 2024-04-26T23:08:40.000Z (8 months ago)
- Last Synced: 2024-05-11T16:35:53.108Z (8 months ago)
- Topics: api, backend, javascript, nodejs, payment-gateway, stripe
- Language: JavaScript
- Homepage:
- Size: 2.59 MB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Stripe Payment Integration in Node.js - [demo](#demo)
This project demonstrates how to integrate the Stripe payment gateway into a Node.js application. With this setup, you can securely process payments for goods or services on your website.
## Prerequisites
Before you begin, ensure you have the following:
- Node.js installed on your system.
- A Stripe account. If you don't have one, you can sign up [here](https://dashboard.stripe.com/register).## Installation
1. Clone or download this repository to your local machine.
2. Navigate to the project directory in your terminal.
3. Install the dependencies by running:
```bash
npm install
```## Configuration
1. Create a `.env` file in the root directory of your project.
2. Add your Stripe API keys to the `.env` file:
```plaintext
STRIPE_SECRET_KEY=your_stripe_secret_key
PUBLISHABLE_KEY=your_stripe_publishable_key
PORT=3000
```
Replace `your_stripe_secret_key` and `your_stripe_publishable_key` with your actual Stripe API keys.## Usage
To start the server, run the following command in your terminal:
```bash
node --env-file=.env app.js
```This will start the server at http://localhost:3000 by default.
EndpointsGET /: Renders the home page with a Stripe payment form.
POST /payment: Handles the payment processing.Code Overview
Dependenciesexpress: Web application framework for Node.js.
body-parser: Middleware to parse incoming request bodies.
ejs: Template engine for rendering views.
stripe: Stripe Node.js library for interacting with the Stripe API.### Demo
![demo](https://github.com/Ulisses22/stripe-pyment-in-nodejs/blob/main/586b36f9-8038-407b-a198-8049fcc8c5c2.gif)app.js
This file contains the main application logic. It sets up the Express server, configures middleware, defines routes, and handles payment processing.
views/Home.ejsThis EJS template renders the home page with a Stripe payment form. It includes the Stripe.js script to securely handle payment information.
package.jsonContains metadata about the project and its dependencies.
LicenseThis project is licensed under the ISC License. See the LICENSE file for details.
Feel free to customize this README to fit your project's specific needs. Happy coding! 🚀