This sample application shows how to integrate Paystack's Subscriptions API in your apps. For the official documentation for Paystack Subscriptions, head over to the docs
View a live demo of the app here.
- A Paystack account: If you don't already have one, sign up for a Paystack account. You'll need to do this to get your API keys.
- API keys: You can grab these from your Paystack dashboard
- Existing plans: You'll need to have existing (active) plan objects that you can subscribe your customers to. If you don't already have any plans, you can just create a couple from your Paystack dashboard
- Clone this repo:
git clone https://github.com/PaystackOSS/sample-subscriptions-app
- Navigate to the root directory and install dependencies
npm install
- Rename the
.env.example
file to.env
and add your Paystack secret key, and your server's URL including the port. This is necessary for the callback URL you'll be redirected to after completing a transaction. You can also change the default port from 5000 to a port of your choosing:
PAYSTACK_SECRET_KEY=sk_domain_xxxxxx
SERVER_URL=http://localhost:5000
- Start the application
npm start
- Visit http://localhost:5000 in your browser to interact with the app. You should be able to signup/login, subscribe to a plan, and view/manage your existing plan(s).
If you notice any issues with this app, please open an issue. PRs are also more than welcome, so feel free to submit a PR to fix an issue, or add a new feature!
This repository is made available under the MIT license. Read LICENSE.md for more information.