billops is a subscription management platform for businesses. It helps businesses manage their subscription models, billing, and user data. Billops offers a dashboard with analytics like revenue, subscribers, and retention rate. Businesses can also manage their subscriptions, coupons, and user details. Billops provides a secure API for organizations to access their data and webhooks to capture payments.
To run this project locally, follow these steps:
- Clone the repository:
git clone https://github.com/Abinash4567/billops
- Install dependencies:
npm install
- Set up pgAdmin or supabase database on your need
- Create a
.env
file like.env.example
- Add database, URL and secret keys in environment variables
- Migrate prisma model to database:
npx prisma migrate
- Check middleware.ts under
billops/src/
and comment line 11 for local run or line 12 for cloud deployment. - Start the development server:
npm run dev
- After setting up the project locally, access the application at
localhost:3000
. - Create an account or log in.
- Mangage Users, Subscription under dashboard.
Parameters
Name | Required | Type | Description |
---|---|---|---|
orgId |
required | Int | Organization Key acts like unique key to identify your organization which is to be passed inside body. To see your organization key, head over to setting under dashboard. |
APIKey |
required | string | API key is high security string which protects endpoint from misuse. Every organization registered under billops has unique one and can be regenerated according to your requirement. It is fired under header section. |
Response status Code: 200
{
"subscriptionDetail": [
{
"id": 1,
"type": "Premium",
"intendedAudience": "Freelancer, Education",
"price": "13",
"features": {
"Updates": "No",
"Revisions": "No",
"Team Size": "2",
"Web hooks": "No",
"Video Client": "No",
"24 Hour Update": "Yes",
"Customer Support": "No"
},
"couponCodes": {
"hello": "23",
"selllo": "12"
},
"validity": 6
}
]
}
or Status Code: 404
{
"message": "We are unable to find your organization."
}
or Status Code: 500
{
message: "Internal Server Error"
}
Parameters
Name | Required | Type | Description |
---|---|---|---|
orgId |
required | Int | Organization Key acts like unique key to identify your organization which is to be passed inside body. To see your organization key, head over to setting under dashboard. |
userId |
required | string | userId is unique user registered in your organization. |
APIKey |
required | string | API key is high security string which protects endpoint from misuse. Every organization registered under billops has unique one and can be regenerated according to your requirement. It is fired under header section. |
Response status Code: 200
{
"userDetail": [
{
"id": 1,
"name": "foo",
"email": "[email protected]",
"planExpiry": "2024-10-13T17:39:47.415Z",
"planType": "Premium"
}
]
}
or Status Code: 404
{
"message": "We are unable to find your organization or user."
}
or Status Code: 500
{
message: "Internal Server Error"
}
Parameters
- Webhook integrated from Razorpay on payment capture
userId
andsubId
are required under notes field to validate payment.name
andemail
are optional for recurring user but compulsory for new user (Best to include everytime).
Sample Response from Razorpay
{
entity: 'event',
account_id: 'acc_M8U2zJ2Lq8Frjk',
event: 'payment.captured',
contains: [ 'payment' ],
payload:
{
payment:
{
entity:
{
id: 'pay_NyurD8IVtZ7zpk',
entity: 'payment',
amount: 49900,
currency: 'INR',
status: 'captured',
order_id: 'order_NyuqYOVecmJ4sX',
invoice_id: null,
international: false,
method: 'netbanking',
amount_refunded: 0,
refund_status: null,
captured: true,
description: 'Thank you for nothing. Please give us some money',
card_id: null,
"notes":
{
"userId": 1,
"subId" 12,
"name": "foo",
"email": "[email protected]",
"address": "Razorpay Corporate Office"
},
bank: 'PUNB_R',
wallet: null,
vpa: null,
email: '[email protected]',
contact: '+918797837542',
fee: 1178,
tax: 180,
error_code: null,
error_description: null,
error_source: null,
error_step: null,
error_reason: null,
acquirer_data: { bank_transaction_id: '8435702' },
created_at: 1713188029,
reward: null,
base_amount: 49900
}
}
},
created_at: 1713188034
}
![logo](https://private-user-images.githubusercontent.com/98229006/322622776-650e670b-5e44-42de-b84d-3046a9bb44d9.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzg5NTc3MjQsIm5iZiI6MTczODk1NzQyNCwicGF0aCI6Ii85ODIyOTAwNi8zMjI2MjI3NzYtNjUwZTY3MGItNWU0NC00MmRlLWI4NGQtMzA0NmE5YmI0NGQ5LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMDclMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjA3VDE5NDM0NFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWZjNTVlMjUyYjRiMGQyYTI2YjZlYzQzMGU1NjAwZjRiZTQ1NzFkNjU4ODhjMTYwM2NjMGM5MDIzNmI5OTIzZmEmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.z-fwwOwbXZgLLmIHhLCTVrl4Q_-IDSHuyBzz5_IFTvk)