https://github.com/zastinian/paypalsandboxapi
This project is an Express application that implements integration with the PayPal API for payment processing. It provides two routes: one for creating a new PayPal order and another for capturing an existing order.
https://github.com/zastinian/paypalsandboxapi
Last synced: about 1 year ago
JSON representation
This project is an Express application that implements integration with the PayPal API for payment processing. It provides two routes: one for creating a new PayPal order and another for capturing an existing order.
- Host: GitHub
- URL: https://github.com/zastinian/paypalsandboxapi
- Owner: Zastinian
- Created: 2023-06-16T18:35:28.000Z (almost 3 years ago)
- Default Branch: master
- Last Pushed: 2023-06-16T19:05:12.000Z (almost 3 years ago)
- Last Synced: 2025-02-10T22:49:52.915Z (over 1 year ago)
- Language: JavaScript
- Homepage: https://developer.paypal.com
- Size: 7.81 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
## Description
This project is an Express application that implements integration with the PayPal API for payment processing. It provides two routes: one for creating a new PayPal order and another for capturing an existing order.
## Prerequisites
Before running the application, make sure you have the following prerequisites:
- Node.js installed on your machine.
- Environment variable configuration:
- `PORT`: Port on which the application will run.
- `PAYPAL_API`: Base URL of the PayPal API.
- `HOST`: Domain name or URL of your application.
- `CLIENT`: PayPal API client.
- `SECRET`: PayPal API secret key.
## Usage
```bash
npm install
npm run dev
```
Once the application is up and running, you can access the following routes:
- `GET /create-order`: Creates a new PayPal order and returns the order data in JSON format.
- `GET /capture-order?token=`: Captures an existing PayPal order using the provided order token as a query parameter.
- `GET /cancel-payment`: Cancels the payment and redirects to the home page.