Console
Pay

Manage Subscription

Get the current subscription details plus a Stripe Customer Portal URL where the user updates their payment method or cancels — no billing UI to build yourself.

POST /api/pay/manage_subscription.php
Requires Authorization: AppID:AppKey + user token

Request body

FieldTypeRequiredDefaultDescription
tokenstringrequiredUser session token
itemKeystringrequiredSubscription plan key
return_urlstringoptionalVanelton IDWhere Stripe sends the user back after they leave the portal
debugbooloptionalfalseUse Stripe test mode

Example

POST /api/pay/manage_subscription.php
Authorization: com.myapp:MyAppKey12345678901234
Content-Type: application/json

{
  "token": "USER_TOKEN",
  "itemKey": "plan-pro"
}

Success response 200

{
  "success": true,
  "subscription": {
    "itemKey": "plan-pro",
    "status": "active",
    "current_period_end": "2025-06-10 14:32:00",
    "stripe_subscription_id": "sub_..."
  },
  "portal_url": "https://billing.stripe.com/p/session/..."
}

Redirect the user to portal_url. From there they can update their card, download invoices, or cancel — Stripe's hosted portal handles all of it, then sends them back to return_url.

Errors

CodeMessageCause
400Missing required parameter 'token' / 'itemKey'.Field not sent
401Invalid or expired token.Bad user token
404No subscription found for this itemKey and user.User never subscribed to this plan
409Subscription record has no Stripe customer associated. Cannot open management portal.Data integrity issue on an old record — contact support
500Failed to create customer portal session. Check server logs.Stripe API error