This repository contains the code for integrating Paystack subscription-based billing into a NestJS application.
- Customer Management: Create and retrieve customer information.
- Subscription Plans: Create and manage subscription plans.
- Webhook Integration: Handle Paystack events like
charge.successandsubscription.create. - Secure API: Ensure webhook authenticity with signature validation.
This application is a simple implementation to demonstrate how to integrate Paystack for subscription-based billing.
It does not include:
- Proper error handling
- Input validation
- Logging mechanisms
- Unit or integration tests
Use it as a reference for building a more robust application.
- Node.js and npm installed
- Paystack account setup (for test/live environments)
- NestJS CLI installed globally (
npm install -g @nestjs/cli)
- Clone the repository:
git clone <repository-url>
- Navigate to the project directory:
cd paystack-nestjs - Install dependencies:
npm install
- Create a
.envfile with your Paystack credentials:PAYSTACK_SECRET=your_paystack_secret_key PAYSTACK_BASE_URL=https://api.paystack.co PAYSTACK_SUCCESS_URL=https://example.com
- Start the development server:
npm run start:dev
- Test webhook events using Webhook.site.
Feel free to fork this repository, create a new branch, and submit a pull request. Contributions are always welcome!
This project is licensed under the MIT License.