Cancel immediately or at period end and return the updated subscription.
Cancel immediately or at period end and return the updated subscription.
ApiKeyAuth In: header
Unique key used to safely retry this write for 24 hours without applying it twice.
1 <= length <= 200application/json
TypeScript Definitions
Use the request body type in TypeScript.
application/json
application/json
application/json
application/json
application/json
application/json
application/json
application/json
application/json
curl -X POST "https://example.com/subscriptions/string/cancel" \ -H "Content-Type: application/json" \ -d '{}'{ "id": "string", "customerId": "string", "plan": { "id": "string", "name": "string", "basePrice": 0 }, "name": "string", "description": "string", "status": "draft", "billingInterval": "weekly", "trialEndsAt": "2019-08-24T14:15:22Z", "currentPeriod": { "start": "2019-08-24T14:15:22Z", "end": "2019-08-24T14:15:22Z", "daysRemaining": 0 }, "cancellation": { "scheduledAt": "2019-08-24T14:15:22Z", "reason": "string", "effectiveAt": "2019-08-24T14:15:22Z" }, "cancelAtPeriodEnd": true, "scheduledPlanChange": { "changeType": "plan_downgrade", "newPlanId": "string", "newPlanName": "string", "newBillingInterval": "string", "scheduledFor": "2019-08-24T14:15:22Z" }, "startDate": "2019-08-24T14:15:22Z", "endDate": "2019-08-24T14:15:22Z", "billingDayOfMonth": -9007199254740991, "nextBillingDate": "2019-08-24T14:15:22Z", "checkoutUrl": "string", "createdAt": "2019-08-24T14:15:22Z", "updatedAt": "2019-08-24T14:15:22Z", "offerApplications": [ { "id": "string", "name": "string", "appliesTo": { "type": "plan_price", "id": "string" }, "offerId": "string", "source": "direct", "status": "quoted", "currency": "string", "subtotal": -9007199254740991, "discountAmount": -9007199254740991, "total": -9007199254740991, "phases": [ { "type": "free_trial", "durationDays": 1, "durationInterval": "weekly", "startsAt": "2019-08-24T14:15:22Z", "endsAt": "2019-08-24T14:15:22Z" } ], "quotedAt": "2019-08-24T14:15:22Z", "expiresAt": "2019-08-24T14:15:22Z", "appliedAt": "2019-08-24T14:15:22Z" } ], "planGrant": { "id": "string", "plan": { "id": "string", "name": "string" }, "expiresAt": "2019-08-24T14:15:22Z" }, "consumptionModel": "metered", "features": [ { "code": "string", "name": "string", "type": "boolean", "enabled": true, "baseAccess": { "enabled": true } } ], "credits": { "remaining": 0, "included": 0, "purchased": 0 }, "balance": { "remaining": 0, "included": 0, "currency": "string" }, "priceId": "string", "object": "subscription", "livemode": true}{ "error": { "type": "string", "code": "string", "message": "string", "param": "string", "details": null, "doc_url": "string" }}{ "error": { "type": "string", "code": "string", "message": "string", "param": "string", "details": null, "doc_url": "string" }}{ "error": { "type": "string", "code": "string", "message": "string", "param": "string", "details": null, "doc_url": "string" }}{ "error": { "type": "string", "code": "string", "message": "string", "param": "string", "details": null, "doc_url": "string" }}{ "error": { "type": "string", "code": "string", "message": "string", "param": "string", "details": null, "doc_url": "string" }}{ "error": { "type": "string", "code": "string", "message": "string", "param": "string", "details": null, "doc_url": "string" }}{ "error": { "type": "string", "code": "string", "message": "string", "param": "string", "details": null, "doc_url": "string" }}{ "error": { "type": "string", "code": "string", "message": "string", "param": "string", "details": null, "doc_url": "string" }}Apply an Offer to a subscription PUT
Apply a direct Offer to a subscription. On a pending payment checkout it quotes or replaces the checkout discount and the existing checkout URL remains unchanged. On an active subscription it applies the Offer immediately with its discount phases starting at the next billing cycle; the call is rejected while another applied Offer still has active or upcoming discount phases. Offers with a free trial phase cannot be applied after checkout creation.
Change plan POST
Upgrade or change billing interval immediately, optionally applying an Offer. Scheduled changes do not accept offers.