Skip to main content
PATCH
/
v1
/
subscriptions
/
{id}
Update Subscription
curl --request PATCH \
  --url https://api.withflex.com/v1/subscriptions/{id} \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "subscription": {
    "cancel_at_period_end": false,
    "trial_end": "2024-01-01T00:00:00Z",
    "items": [],
    "proration_behavior": "always_invoice",
    "cancel_at": "2024-01-01T00:00:00Z",
    "metadata": {},
    "coupon": "string"
  }
}
'
{
  "subscription": {
    "subscription_id": "obj_01EXAMPLE00000000000000000",
    "created_at": "2024-01-01T00:00:00Z",
    "items": [
      {}
    ],
    "latest_invoice": "string",
    "customer": "string",
    "status": "incomplete",
    "cancel_at_period_end": false,
    "current_period_end": "string",
    "current_period_start": "string",
    "metadata": {},
    "test_mode": false,
    "client_secret": {
      "setup_secret": "string",
      "payment_secret": "string"
    },
    "proration_behavior": "always_invoice",
    "trial_start": "string",
    "trial_end": "string",
    "cancel_at": "2024-01-01T00:00:00Z",
    "default_payment_method": "string"
  }
}

Authorizations

Authorization
string
header
required

Use a Bearer token to access this API.

Path Parameters

id
string
required
Example:

"obj_01EXAMPLE00000000000000000"

Query Parameters

expand_customer
boolean | null

If true, expands the customer object in the response.

Example:

false

expand
string
default:""

Comma-separated list of related objects to expand in the response.

Body

application/json
subscription
object
required
Example:
{
  "cancel_at_period_end": false,
  "trial_end": "2024-01-01T00:00:00Z",
  "items": [{ "price": "string" }],
  "proration_behavior": "always_invoice",
  "cancel_at": "2024-01-01T00:00:00Z",
  "metadata": {},
  "coupon": "string"
}

Response

Success

subscription
object
required
Example:
{
  "subscription_id": "obj_01EXAMPLE00000000000000000",
  "created_at": "2024-01-01T00:00:00Z",
  "items": [
    {
      "subscription_item_id": "obj_01EXAMPLE00000000000000000",
      "quantity": 0,
      "created_at": "2024-01-01T00:00:00Z",
      "updated_at": "2024-01-01T00:00:00Z",
      "test_mode": false
    }
  ],
  "latest_invoice": "string",
  "customer": "string",
  "status": "incomplete",
  "cancel_at_period_end": false,
  "current_period_end": "string",
  "current_period_start": "string",
  "metadata": {},
  "test_mode": false,
  "client_secret": {
    "setup_secret": "string",
    "payment_secret": "string"
  },
  "proration_behavior": "always_invoice",
  "trial_start": "string",
  "trial_end": "string",
  "cancel_at": "2024-01-01T00:00:00Z",
  "default_payment_method": "string"
}