Subscription - OgnianApostolov/builderly-api-docs GitHub Wiki
Model
Subscription subscription {
"_id": {
"autogenerated": "true"
},
"stripe_subscription_id": {
"type": "string"
},
"user_id": {
"ref": "User._ObjectId",
"required": "true"
},
"status": {
"type": "number",
"default": 0
},
"payment_intent_id": {
"type": "string"
},
"price_plan": {
"ref": "PricePlan._ObjectId",
"required": "true"
},
"createdAt": {
"autogenerated": "true"
},
"updatedAt": {
"autogenerated": "true"
}
}
Methods
Create new
POST /subscriptions
req.body required
method: 'POST'
{
url: 'https://{{your-builderly-domain}}/subscriptions,
headers: {
'Authorization': 'Bearer ' + token
},
json: true,
body: {}
}
Responses
Success - status 201
{}
Error - status 400
{
error_message
}
Retrieve multiple
GET /subscriptions
method: 'GET'
{
url: 'https://{{your-builderly-domain}}/subscriptions',
headers: {
'Authorization': 'Bearer ' + token
},
json: true,
body: {}
}
Responses
Success - status 200
[ subscriptions ]
Error - status 400
{
error_message
}
- Example usages:
/subscriptions
- Get all subscriptions
Retrieve single
GET /subscriptions/:id
method: 'GET'
{
url: 'https://{{your-builderly-domain}}/subscriptions/{{subscription._id}},
headers: {
'Authorization': 'Bearer ' + token
},
json: true,
body: {}
}
Responses
Success - status 200
{ subscription }
Not found - status 404
{}
Error - status 500
{
error_message
}
- Example usages:
/subscriptions/:id
- Retrives a specific subscription
Update single
PATCH /subscriptions/:id
method: 'PATCH'
{
url: 'https://{{your-builderly-domain}}/subscriptions/{{subscription._id}}',
headers: {},
json: true,
body: {}
}
Responses
Success - status 200
{ subscription }
Error - status 400
{
error_message
}
Not found - status 404
{}
Delete single
DELETE /subscriptions/:id
method: 'DELETE'
{
url: 'https://{{your-builderly-domain}}/subscriptions/{{subscription._id}}',
headers: {},
json: true,
body: {}
}
Responses
Success - status 200
{ subscription }
Not found - status 404
{}
Error - status 500
{
error_message
}