Cancel Subscription
Changed onCancels a customer's subscription. By default the subscription is canceled immediately; set cancel_at_period_end to true to keep it active until the end of the current billing period instead.
Optionally issue a refund as part of the cancellation by setting refund to full, prorated, or custom (a custom refund requires a positive refund_amount in the smallest currency unit). Refunds are processed as a separate operation from the cancellation. The request body is optional; omitting it cancels immediately with no refund.
Request
- Base URLhttps://api.withflex.com
- URLhttps://api.withflex.com/v1/subscriptions/{id}
- AuthHTTP bearer
Path parameters
Request body
Example request
{
"subscription": {
"cancel_at_period_end": false,
"refund": "none",
"refund_amount": 2500
}
}Response
An envelope wrapping a single subscription object.
Example response
{
"subscription": {
"subscription_id": "fsub_01J9XR8M3K7VZ8N2YB4WJ6T0RA",
"created_at": "2026-06-15T14:30:00Z",
"items": [
{
"subscription_item_id": "fsubi_01J9XR8M3K7VZ8N2YB4WJ6T0RA",
"price": "fprice_01J9XR8M3K7VZ8N2YB4WJ6T0RA",
"quantity": 2500,
"created_at": "2026-06-15T14:30:00Z",
"updated_at": "2026-06-15T14:30:00Z",
"test_mode": false
}
],
"latest_invoice": "fin_01J9XR8M3K7VZ8N2YB4WJ6T0RA",
"customer": "fcus_01J9XR8M3K7VZ8N2YB4WJ6T0RA",
"status": "incomplete",
"cancel_at_period_end": false,
"current_period_end": "string",
"current_period_start": "string",
"metadata": {
"order_id": "8842",
"channel": "shopify"
},
"test_mode": false,
"client_secret": {
"setup_secret": "string",
"payment_secret": "string"
},
"proration_behavior": "always_invoice",
"trial_start": "string",
"trial_end": "string",
"cancel_at": "2026-06-15T14:30:00Z",
"canceled_at": "2026-06-15T14:30:00Z",
"default_payment_method": "fpm_01J9XR8M3K7VZ8N2YB4WJ6T0RA",
"backup_payment_method": "fpm_01J9XR8M3K7VZ8N2YB4WJ6T0RA",
"discounts": [
{
"discount_id": "fdi_01J9XR8M3K7VZ8N2YB4WJ6T0RA",
"checkout_session": "fcs_01J9XR8M3K7VZ8N2YB4WJ6T0RA",
"customer": "fcus_01J9XR8M3K7VZ8N2YB4WJ6T0RA",
"subscription": "fsub_01J9XR8M3K7VZ8N2YB4WJ6T0RA",
"invoice": "fin_01J9XR8M3K7VZ8N2YB4WJ6T0RA",
"source": {
"coupon": "fcoup_01J9XR8M3K7VZ8N2YB4WJ6T0RA",
"type": "coupon"
},
"promo_code": "fpromo_01J9XR8M3K7VZ8N2YB4WJ6T0RA",
"test_mode": false,
"end": "string",
"start": "string"
}
],
"pause": {
"paused_at": "2026-06-15T14:30:00Z",
"resume_at": "2026-06-15T14:30:00Z",
"billing_cycle_anchor": "unchanged",
"proration_behavior": "always_invoice",
"credit": "unused_time"
}
}
}Changes
- breaking
the
//////////response's property format changed fromemailto no format for status - breaking
the
///////////////response's property format changed fromemailto no format for status - warning
the
/request property's max was set to9007199254740991.00 - warning
the
/request property's min was set to-9007199254740991.00 - warning
added the new
adaptiveShoesDependentenum value to the/////////////////response property for the response status - warning
added the new
automatedCleanerenum value to the/////////////////response property for the response status - warning
added the new
babyMonitorSplitenum value to the/////////////////response property for the response status - warning
added the new
babySleepAppenum value to the/////////////////response property for the response status - warning
added the new
bodyPillowenum value to the/////////////////response property for the response status - warning
added the new
breathWorkDependentenum value to the/////////////////response property for the response status - warning
added the new
coolingSleepwearenum value to the/////////////////response property for the response status - warning
added the new
meneralsNootropicPouchenum value to the/////////////////response property for the response status - warning
added the new
nonenalOdorenum value to the/////////////////response property for the response status - warning
added the new
nursingChairsenum value to the/////////////////response property for the response status - warning
added the new
speechHealthDependentenum value to the/////////////////response property for the response status - warning
added the new
uvClothingenum value to the/////////////////response property for the response status - warning
added the new
uvGlassesenum value to the/////////////////response property for the response status - info
added the optional property
/to the response with the status - info
added the optional property
////////to the response with the status - info
added the optional property
/to the response with the status
- breaking