Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/nidhish-nayak/node-razorpay

Node express server for Razorpay integrations. This repository handles all the backend and payment-integration api for the project "fabric-clothing".
https://github.com/nidhish-nayak/node-razorpay

axios express node razorpay-payment rest-api

Last synced: about 2 months ago
JSON representation

Node express server for Razorpay integrations. This repository handles all the backend and payment-integration api for the project "fabric-clothing".

Awesome Lists containing this project

README

        

# ๐ŸŒŸ Razorpay Payment Gateway API with NodeJS ๐ŸŒŸ

Supercharge your Node.js server with the power of Razorpay payment gateway!

## โœจ Prerequisites

Before you dive into the magic of Razorpay Payment Gateway Integration API, make sure you have the following enchantments ready:

- ๐Ÿง™โ€โ™‚๏ธ Node.js installed on your machine.
- ๐Ÿงช A mystical Razorpay account with API key and secret.

## ๐Ÿš€ Getting Started

To embark on this mystical journey, follow these steps:

1. โœจ Clone the repository and enter the magical realm:

```bash
git clone
cd node-razorpay
```

2. ๐Ÿง™โ€โ™‚๏ธ Cast the spell to install the dependencies:

```bash
npm install
```

3. ๐Ÿ“œ Create a `.env` scroll in the root directory and inscribe your Razorpay API key and secret within:

```plaintext
RAZORPAY_KEY_ID=
RAZORPAY_SECRET=
```

4. ๐ŸŽฉ Wave your wand to start the server:

```bash
npm run dev
```

The portal to the server will open at http://localhost:4000. Enter at your own risk!

## ๐Ÿง™โ€โ™‚๏ธ API Endpoints

The API is home to the following magical portals:

#### โœจ GET /orders

- This ๐Ÿ”ฎ portal allows you to create a Razorpay order with just a flick of your wand. Simply provide the desired `price` and behold the order details that will be revealed to you!

#### ๐ŸŽ Request Parameters

- `price` (query parameter): The price of the order you wish to create.

#### ๐Ÿ”ฎ Response

- Success: 200 OK! The order details will be unveiled in the response body, ready for you to explore.
- Error: 500 Internal Server Error! An error message will be revealed, guiding you through the troubles.

#### โœจ GET /orders/:orderId/payments

- This ๐ŸŒŸ portal allows you to fetch the payments associated with a specific order. Provide the `orderId` and witness the magical details of the payments unfold before your eyes!

#### ๐ŸŽ Request Parameters

- `orderId` (query parameter): The ID of the order for which you want to fetch the payments.

#### ๐Ÿ”ฎ Response

- Success: 200 OK! The payment details will be revealed in the response body, showcasing the captivating information.
- Error: 500 Internal Server Error! An error message will be unveiled, guiding you through the troubles.

## ๐Ÿง™โ€โ™‚๏ธ Usage

To create a Razorpay order, whisper the sacred incantation in the form of a GET request to the `/orders` portal, with the `price` query parameter set to the desired amount. The API will wield its powers to create the order and reveal its magnificent details.

๐Ÿช„ Example Incantation:

```http
GET /orders?price=1000
```

โšก๏ธ Example Response:

```json
{
"id": "order_1234567890",
"entity": "order",
"amount": 1000,
"currency": "INR",
"receipt": "receipt#1",
"createdAt": 1671234567
// ... other captivating order details
}
```

To fetch the payments associated with a specific order, conjure a GET request to the `/orders/:orderId/payments` portal, replacing `:orderId` with the actual ID of the order

. The API will unleash its powers and reveal the mesmerizing payment details.

๐Ÿช„ Example Incantation:

```http
GET /orders/order_1234567890/payments
```

โšก๏ธ Example Response:

```json
{
"count": 2,
"entity": "collection",
"items": [
{
"id": "pay_1234567890",
"entity": "payment",
"order_id": "order_1234567890",
"amount": 1000,
"status": "captured"
// ... other captivating payment details
},
{
"id": "pay_0987654321",
"entity": "payment",
"order_id": "order_1234567890",
"amount": 2000,
"status": "captured"
// ... other captivating payment details
}
]
// ... other captivating collection details
}
```

## โœจ Contributing

Join the league of magical developers! Contributions are welcomed and celebrated in this mystical realm. If you encounter any issues or have ideas for enchantments, feel free to open an issue or cast a pull request.

## ๐Ÿ“œ License

#### This project is licensed under the [MIT License](LICENSE). Cast your spells responsibly!

Feel free to further customize the README according to your project's requirements and add any additional information or sections as needed.

Happy coding!