Skip to content

Subscription ​

Overview ​

Billing runs on Stripe (stripe/stripe-php, Stripe\StripeClient built from dam.STRIPE_SECRET). Plans are Subscriptions rows; each has a stripe_reference_id (the Stripe price) and a features JSON. When a workspace subscribes, a SubscriptionUsers row stores the workspace's copy of features plus Stripe ids (stripe_customer_id, stripe_subscription_id), status, billing_cycle, trial fields (is_trial_account, trial_end_date, trial_expire), is_suspended, payment_pause and the AI image token balance openai_image_count.

Plans, add-ons, coupons, inquiries and customer accounts are managed by Collage staff in the Blade super-admin under /admin/subscription/* (web guard, Web\Subscription\* controllers); PlanController creates the matching Stripe plans through Subscriptions::createStripePlan(). Workspace owners use the Admin API (/api/v1/digital-assets/subscription/*). Signup and checkout callbacks use public routes under /api/v1/subscription/*. There is no Stripe webhook route; state changes come from these callbacks and the scheduled commands below.

Plan limits ​

Limits are enforced in code through DamInstance::checkFeatureRestriction($userId, $workspaceId, $feature), which reads SubscriptionUsers.features and returns ['enable' => false, 'message' => 'Please upgrade your plan to access this feature.'] when blocked, or Your subscription is not found. when the workspace has no subscription row.

Feature keyRuleChecked by
storageSum of assets_versions.file_size (not final deleted) must not exceed default_value GB (1000^3 bytes) unless unlimitedUpload, move, copy
users / admin_usersActive plus pending seats below users / adminPortal user invite, workspace user invite
image_generationOff for lite-monthly / lite-yearly, or when openai_image_count is 0Returned in the feature map (GET /user); no controller passes this key
asset_versioning, asset_embedding, asset_conversion, ai_based_asset_auto_tagging, public_and_private_asset_customisation, acl_wordpress_integration, manage_banner_and_tiles, per_asset_analytics, share_asset_analytics, folder_permission_customisation, dam_brandingThe feature's enable flagThe matching endpoints

The checkStorageLimit middleware (DAMStorageLimit) is registered in Kernel.php but no route uses it; storage is only enforced through checkFeatureRestriction(). GET /api/v1/user and GET /dam/v1/user return the feature map and fire UpdateSubscriptionRestrictionEvent, whose listener resets workspace branding colours when dam_branding is off and turns branding off when email_branding is off.

Endpoints ​

Public (/api/v1/subscription) ​

MethodPathController@methodPurpose
GET/{subscription_name}/detailSubscriptionController@subscriptionDetailPlan group detail with current usage
POST/inquiry/{id}/activationSubscriptionController@subscriptionActivationAfter checkout: create the owner user and SubscriptionUsers
POST/inquiry/payment-intentSubscriptionController@updateInquiryRecord payment status from checkout
POST/change-user-planSubscriptionController@changeUserPlanUpgrade now or schedule a downgrade
POST/downgrade-planSubscriptionController@downgradePlanApply a downgrade
POST/update-event-sentSubscriptionController@updateEventSentFalseReset the event-sent flag
POST/update-subscription-dateSubscriptionController@updateSubscriptionDateRoute exists, but the controller has no such method in this snapshot
POST/add-payment-methodSubscriptionController@addPaymentMethodAttach a payment method, resume collection
POST/buySubscriptionController@buyAddonBuy an add-on (image tokens)

Admin API (/api/v1/digital-assets/subscription) ​

MethodPathController@methodPurpose
GET/getSubscriptionController@userActiveSubscriptionCurrent subscription
POST/make-default-card, /delete-cardSubscriptionController@makeDefaultCard, @deleteCardStripe customer cards
POST/cancelSubscriptionController@cancelSubscriptionCancel at period end
POST/re-activateSubscriptionController@reActivateSubscriptionUndo cancellation
POST/cancel-trialSubscriptionController@cancelTrialEnd a trial
POST/delete-all-dataSubscriptionController@deleteAllDataQueue full workspace data removal
POST/activity-logSubscriptionController@activityLogWrite a subscription activity row
GET/storage-analytics, /send-storage-analytics-emailAnalyticsController@storageAnalytics, @sendStorageAnalyticsEmailStorage usage

Workflows ​

Signup activation ​

The owner then sets a password through POST /api/v1/generate-common-password, which activates the user and the SubscriptionUsers row and queues UserWelcomeEmailJob. inquiry/payment-intent updates payment_status on the inquiry and subscription user and sends the activation link once a payment succeeds. These routes have no auth middleware.

Change plan ​

Downgrades take effect at the end of the current period through a Stripe subscription schedule; downgrade-plan applies the stored downgrade to the database. cancel sets cancel_at_period_end (and cancels open schedules) and queues SubscriptionCancelEmailJob; re-activate reverses it.

Daily subscription commands ​

dam:trial-expire picks trial accounts whose trial_end_date has passed. The branch meant for customers with a saved card compares the string 'trial_expire' with false, which is never true, so every expired trial goes to the pause branch: collection is paused in Stripe and payment_pause = 1. dam:SuspendAccount only acts on rows with is_suspended = 1 and delete_all_data = 0. Suspension is also checked at login (This account is suspended...). delete-all-data from the owner queues DAMRemoveWorkspaceData on the high queue.

Data ​

Model / tableUse
Subscriptions / subscriptionsPlans, features, stripe_reference_id, slug, group_name
SubscriptionUsers / subscription_usersWorkspace subscription and feature copy
DamInquiryCheckout inquiries
SubscriptionAddon, SubscriptionUserAddon, AddonAdd-ons
CouponsCoupons
SubscriptionUserActivitySubscription activity log
AssetsVersion.file_sizeStorage usage