POST /api/v4/subscriptions
Create subscription

Request headers

Only registered user can perform this action
  Authentication - string - required
    Example of Authentication header : "Bearer TOKEN_FETCHED_FROM_SERVER_DURING_REGISTRATION"

Request boby example

{
  "subscription": {
    "plan_id": 1,
    "token": "sk_JfsH5ur87",
    "coupon_id": 3
  }
}

Success response body

{
  "success": true
}

Status 403 error message

{
  permissions: ['denied'],
  message: 'permissions_denied'
}

Status 422 error message

{
  "message": "MESSAGE"
}

Errors

Code Description
unauthorized
forbidden
unprocessable_entity

Params

Param name Description
subscription
required

Validations:

  • Must be a Hash

subscription[plan_id]
required

ID of plan

Validations:

  • Must be a Integer

subscription[token]
required

Stripe token

Validations:

  • Must be a String

subscription[coupon_id]
optional

Coupon

Validations:

  • Must be a Integer


GET /api/v4/subscriptions/edit
Get Proration

Request headers

Only registered user can perform this action
  Authentication - string - required
    Example of Authentication header : "Bearer TOKEN_FETCHED_FROM_SERVER_DURING_REGISTRATION"

Success response body

{
  "proration_amount": 89999,
  "with_coupon": false
}

Status 403 error message

{
  permissions: ['denied'],
  message: 'permissions_denied'
}

Status 404 error message

{
  "message": "subscription not found"
}

Errors

Code Description
unauthorized
forbidden
not_found

Params

Param name Description
plan_id
required

ID of plan

Validations:

  • Must be a Integer