Path Parameters
Unique identifier of the subscription to update.Example: "sub_x1y2z3a4b5c6d7e8f9g0"
Request Body
Updated subscription status.Options: "ACTIVE", "CANCELLED", "INCOMPLETE", "EXPIRED", "PAUSED", "DRAFT"
ISO 8601 timestamp for when the subscription should be cancelled.Example: "2024-12-31T23:59:59Z"
Whether the subscription should cancel at the end of the current period.Example: true
Parent subscription ID for hierarchy. Set to empty string "" to remove parent relationship. Omit to leave unchanged.Example: "sub_parent123"
Response
Unique identifier for the subscription.
Updated subscription status.
Updated cancellation date (if set).
Updated cancel at period end flag.
Updated parent subscription ID (if set).
ISO 8601 timestamp when subscription starts.
ISO 8601 timestamp of current billing period start.
ISO 8601 timestamp of current billing period end.
ISO 8601 timestamp when the subscription was created.
ISO 8601 timestamp when the subscription was last updated.
Example Request
curl --request PUT \
--url https://api.flexprice.io/v1/subscriptions/sub_x1y2z3a4b5c6d7e8f9g0 \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"cancel_at_period_end": true
}'
Example Response
{
"id": "sub_x1y2z3a4b5c6d7e8f9g0",
"customer_id": "cust_a1b2c3d4e5f6g7h8i9j0",
"plan_id": "plan_a1b2c3d4e5f6g7h8i9j0",
"subscription_status": "ACTIVE",
"currency": "usd",
"billing_cadence": "IN_ADVANCE",
"billing_period": "MONTH",
"billing_period_count": 1,
"start_date": "2024-03-20T00:00:00Z",
"current_period_start": "2024-03-20T00:00:00Z",
"current_period_end": "2024-04-20T00:00:00Z",
"cancel_at_period_end": true,
"metadata": {
"source": "website"
},
"created_at": "2024-03-20T15:04:05Z",
"updated_at": "2024-03-20T16:22:18Z"
}