Change a subscription's items, its cancel or its metadata
/api/v1/subscriptions/{id}Send metadata to replace the subscription's tags, alone or in the same request as a change of the items or of the cancel described below. null or an empty object removes them. Metadata can be set on a subscription in any status. To change the cancel, send cancelAtPeriodEnd, cancellationDetails or both, without items. cancelAtPeriodEnd false before cancelAt withdraws a scheduled cancel: the subscription renews again and its cancellationDetails are cleared. cancelAtPeriodEnd true schedules a cancel at the period end, as cancelSubscription does. cancellationDetails sets feedback and comment on a subscription with a cancel scheduled, or one that is canceled or expired; a field you leave out keeps its value. A canceled or expired subscription takes only cancellationDetails. To change the items, send the full list of items you want: one flat price with its seats, and up to 10 metered prices. A change of the flat price or seats follows timing and proration, or your upgradeTiming and upgradeProration settings, or downgradeTiming and downgradeProration, when you leave them out. An upgrade has the same or a higher amount per period (price times seats), a downgrade a lower one. With timing now, proration create_prorations and none apply the change now and need no payment now: create_prorations adds an upgrade's difference for the rest of the current period and the periods paid ahead to the next invoice and credits a downgrade at once. Timing period_end applies at the next renewal, ignores proration and replaces a change that is already waiting. Proration always_invoice opens an invoice for the difference. On a subscription collected by checkout the change applies when that invoice is paid, and the invoice is voided after 24 hours, or at the end of the current period when that comes first, if it is not. On a subscription collected by invoice the invoice is due in daysUntilDue days, is emailed to the customer with its pay link, and your invoiceStartAccess setting decides: with immediately the change applies now and an invoice still unpaid at its due date expires the subscription; with after_payment the invoice is due at the end of the current period instead when that comes first, the change applies when the invoice is paid in full, and it is dropped if the invoice is not paid by its due date. A change of interval or interval count is an upgrade when the new price costs the same or more over a year, and follows the same settings. Applied now, it starts a new period at once: paidThrough and the billing anchor move to the change, and an invoice for the new period opens with a negative unused_time line for the unused time of the old price, capped at that invoice's total, with the rest added to the customer's credit. With always_invoice the change waits until that invoice is paid in full, and the new period then starts at the time of the request. While the renewal invoice is open a change of interval with timing now is refused, and always_invoice is refused for a subscription with a metered item. A metered price is added or removed at once by default, or at the next renewal when effective is renewal. A trialing subscription takes every change at once. Send the quoteId of a change preview, with the same items, effective, timing and proration, to get the amounts that preview showed. Send items as null to withdraw the changes that are waiting.
Authorization
bearerAuth An access token from POST /api/v1/oauth/token, sent as Authorization: Bearer <token>.
In: header
Path Parameters
The subscription's ID.
uuidHeader Parameters
The API version to use for this request, a date such as 2026-11-06. Without it the request uses your default version for the mode of your key. An unknown version answers 400 api_version_invalid.
Value in
- "2026-11-06"
A unique key you choose for this request: 1 to 255 visible ASCII characters, no spaces. A UUID works well. Never put personal data in it. If a request times out, send it again with the same key and the same body to get the first response back, with the header Idempotent-Replayed: true. A key is kept for 24 hours. Sending the same key with another body answers 400 idempotency_key_reused.
^[\x21-\x7E]+$1 <= length <= 255Request Body
application/json
A change of the subscription's items, or of its cancel. Send items, effective, timing, proration and quoteId, or cancelAtPeriodEnd and cancellationDetails, not both. metadata can go with either, or alone.
Response Body
application/json
application/json
application/json
application/json
application/json
application/json
curl -X PATCH "https://api-malipo.flex.co.tz/api/v1/subscriptions/497f6eca-6276-4993-bfeb-53cbbbba6f08" \ -H "Authorization: Bearer <token>" \ -H "FlexMalipo-Version: 2026-11-06" \ -H "Idempotency-Key: 5f1c1e0a-3b7e-4c8e-9d1a-2f6b8a4c7e11" \ -H "Content-Type: application/json" \ -d '{}'{ "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", "livemode": true, "customerId": "87d8e330-2878-4742-a86f-dbbb3bf522ac", "customer": { "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", "livemode": true, "name": "Amina Juma", "email": "amina@example.com", "phone": 255744553111, "externalId": "user_8841", "locale": "en", "metadata": { "property1": "string", "property2": "string" }, "zeroUsageInvoice": "follow", "createdAt": "2019-08-24T14:15:22Z", "updatedAt": "2019-08-24T14:15:22Z" }, "status": "active", "items": [ { "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", "priceId": "b245ceea-4bc7-4619-ae4c-559a1faf418e", "price": { "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", "livemode": true, "productId": "dcd53ddb-8104-4e48-8cc0-5df1088c6113", "product": { "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", "livemode": true, "name": "Pro plan", "description": "Everything in Basic, plus reports.", "active": true, "metadata": { "property1": "string", "property2": "string" }, "features": [ { "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", "livemode": true, "lookupKey": "queues", "name": "Queues", "description": "string", "limit": 15, "limitPerSeat": true, "createdAt": "2019-08-24T14:15:22Z" } ], "defaultPriceId": "c79663b6-9012-4d9a-bc6f-db5a00400fac", "defaultPrice": {}, "createdAt": "2019-08-24T14:15:22Z", "updatedAt": "2019-08-24T14:15:22Z", "brandId": "0e9bcbb3-096e-49f9-aeea-7a13a201eff5" }, "type": "RECURRING", "unitAmount": 15000, "unitAmountDecimal": 15000, "currency": "TZS", "interval": "MONTH", "intervalCount": 1, "maxPeriods": 12, "active": true, "lookupKey": "pro_monthly", "metadata": { "property1": "string", "property2": "string" }, "createdAt": "2019-08-24T14:15:22Z", "updatedAt": "2019-08-24T14:15:22Z", "usageType": "FLAT", "meter": "08cfef1f-f291-40f5-b1b8-05ac0989f419", "pricingModel": "PER_UNIT", "tiers": [ { "upTo": 1000, "unitAmount": 3, "unitAmountDecimal": 0.5, "flatAmount": 2000 } ], "rates": [ { "dimensions": { "network": "vodacom" }, "unitAmount": 3, "unitAmountDecimal": 3 } ], "subscriptionCount": 3 }, "usageType": "FLAT", "quantity": 1, "meterId": "e6fc0364-7430-4b9c-ab62-413ce7e2f3ee", "nextPriceId": "93df8cb9-3a06-41a4-b6a9-9ff93f3029ef", "nextQuantity": 0, "pendingAdd": true, "pendingRemove": true, "startsAt": "2019-08-24T14:15:22Z", "endsAt": "2019-08-24T14:15:22Z" } ], "billingAnchor": "2019-08-24T14:15:22Z", "paidThrough": "2019-08-24T14:15:22Z", "trialEnd": "2019-08-24T14:15:22Z", "canceledAt": "2019-08-24T14:15:22Z", "accessEndsAt": "2019-08-24T14:15:22Z", "createdAt": "2019-08-24T14:15:22Z", "updatedAt": "2019-08-24T14:15:22Z", "collectionMethod": "checkout", "daysUntilDue": 30, "cancelAtPeriodEnd": false, "cancelAt": "2019-08-24T14:15:22Z", "endedAt": "2019-08-24T14:15:22Z", "cancellationDetails": { "reason": "cancellation_requested", "feedback": "too_expensive", "comment": "string" }, "metadata": { "property1": "string", "property2": "string" }, "brandId": "0e9bcbb3-096e-49f9-aeea-7a13a201eff5", "trialUsage": { "mode": "free_up_to", "amount": 5000, "currency": "TZS" }}