Comments (1)
Payment integration - proposal
Creaiting new payment:
POST /users/me/subscriptions
input:
{
"tierId": 1
}
output:
{
"subscriptionId": 1,
"payUrl": "bitcoin:tb1qufxkm89aybhp600aycm54s5ycdj2pqz9hzxj4l?amount=0.40162157",
"url": "https://api-demo.forgingblock.io/invoice?id=7hqLE4VN5eS5DyhZLzCVby"
}
Users can have only one subscription activated at the time. If a user doesn't have any, the default tier is used as a fallback.
Canceling subscription:
DELETE /users/me/subscriptions/1
Subscriptions list:
GET /users/me/subscriptions
optional filter: GET /users/me/subscriptions?active=true
output:
[
{
"id": 1,
"tier": "shared",
"subtier": "free",
"price": 12.23,
"dateended": "2019-11-11T12:59:49+00:00",
"active": true
}
]
DB changes:
--- a/doc/nautilus.sql
+++ b/doc/nautilus.sql
@@ -26,6 +26,7 @@ create TABLE tiers_configuration(
dailyhits integer NOT NULL,
maxresultsetsize integer NOT NULL,
startdate timestamp NOT NULL,
+ price money NOT NULL,
FOREIGN KEY (tier, subtier) REFERENCES tiers (tier, subtier)
);
create TABLE users(
@@ -56,6 +57,18 @@ create TABLE api_keys(
REFERENCES users (userid) MATCH SIMPLE
ON update NO ACTION ON delete NO ACTION
);
+create TABLE subscriptions(
+ userid integer NOT NULL,
+ tierid serial NOT NULL,
+ price money NOT NULL,
+ dateended timestamp with time zone,
+ CONSTRAINT userid_fk FOREIGN KEY (userid)
+ REFERENCES users (userid) MATCH SIMPLE
+ ON update NO ACTION ON delete NO ACTION
+ CONSTRAINT tierid_fk FOREIGN KEY (tierid)
+ REFERENCES tiers (tierid) MATCH SIMPLE
+ ON update NO ACTION ON delete NO ACTION
+);
create TABLE usage_left(
key text NOT NULL,
daily integer NOT NULL,
Enpoinds from forging block used
POST /create-invoice
with IPN
POST /check-invoice-status
Further expansions
- recurring payments
from nautilus-cloud.
Related Issues (20)
- POC: Add CORS support
- Refreshing API key method should return new API key HOT 1
- Gitlab federated login support
- Gitlab login UX changes
- Support for administration endpoints
- Bootstraping an administrator HOT 8
- Introduce new endpoint to search users by ApiKeys HOT 1
- Disable old demo site HOT 1
- Update user registration flow to handle TOS recording along with other attributes
- Discuss the NC LDM
- Docker file needs to copy correct jar
- Dev Ops Tooling
- Deprecate cookie support on the backend HOT 1
- Add support for ToS reacceptance HOT 1
- Add audit / history feature for accounts
- Build a nginx module for metering HOT 1
- Add an endpoint to display usage data to clients
- Collect and record high level statistics from the metering systems HOT 2
- Add additional config paramters to Metering API config
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nautilus-cloud.