Change user subscription

Change user current subscription

By default, all users are subscribed to the free plan.

URL:  [POST] /api/v1/profile/subscriptions/change

curl -X 'POST' \  'BASE_URL/api/v1/profile/subscriptions/change \  -H 'accept: application/json' \  -H 'Authorization: bearer YOUR_AUTH_TOKEN  -H 'Content-Type: application/json'   -d "{ \"subscriptionPlan\": \"SUBSCRIPTION_PLAN_NUMBER\"}"

Response JSON

{
  "code": 200,
  "message": "Subscription changed successfully",
  "data": {
    "session_id": "0c3e525a-33de-4a85-9fbc-xxx",
    "payment_url": "https://sandbox.woocommerce.com/confirm-subscription/xxxxx",
    "current_subscription": {
      "is_expired": false,
      "is_period_expired": false,
      "id": 1038,
      "is_current": true,
      "subscription_plan": {
        "id": 7,
        "plan_name": "Yearly",
        "recurring_type": "year",
        "amount": 59,
        "is_default": false,
        "subscription_product": {
          "id": 1,
          "name": "Annual TRADEMARK FREE",
          "max_allowed_apps": 1,
          "description": "Get all default APPExperts features + remove APPExperts watermark from your app.",
          "watermark": false,
          "features": []
        }
      },
      "start_date": "2023-05-17T00:00:00+03:00",

Request parameters

Parameter nameValueDescriptionOptional 
subscriptionPlanstringSubscription plan ID, different from current plan IDNo

Request parameters

Parameter nameValueDescriptionOptional 
session_idstringSubscription created session IDNo
payment_urlstringCheckout page URLNo
current_subscriptionobjectCurrent subscription objectNo
idintID of the current subscription
is_expiredboolBool true if current subscription expired (considering permit days)No
is_period_expiredboolBool true if current subscription expiredNo
is_currentboolAlways true in this APINo
start_datedatetimeStart date of current subscription periodNo
end_datedatetimeActual end date of current subscription period, null if not endedYes
expected_end_datedatetimeExpected end date for the current subscription periodNo
cancel_at_period_endboolTrue if customer requested cancel subscription, false otherwise
subscription_planobjectSubscription plan objectNo
idintSubscription plan IDNo
plan_namestringSubscription plan nameNo
recurring_typestringSubscription plan recurring type: year, month, weekNo
amountintSubscription plan amountNo
is_defaultboolTrue if this plan is the free plan, false otherwiseNo
subscription_productobjectSubscription product objectNo
idintSubscription product IDNo
namestringSubscription product nameNo
max _allowed _appsintMax allowed apps to be created by the clientNo
descriptionstringSubscription product descriptionNo
watermarkboolFalse if watermark is removed, true otherwiseNo
featuresarrayArray of features the user will have by subscribing to this planNo

Powered by BetterDocs