Subscriptions

Preview a change of a subscription's items

POST/api/v1/subscriptions/{id}/change-preview

Takes the same body as updateSubscription and shows what that request would do, without changing anything: the lines it produces, the amount due now, the new paidThrough, the next renewal date and amount, and the items as they would be. items must be a list, since there is nothing to preview when you withdraw changes. The amounts are those of this moment. The answer has a quoteId that is valid for a short time (see quoteExpiresAt). Send it on updateSubscription, with the same items, effective, timing and proration, to get exactly the amounts shown here.

Authorization

bearerAuth
AuthorizationBearer <token>

An access token from POST /api/v1/oauth/token, sent as Authorization: Bearer <token>.

In: header

Path Parameters

id*string

The subscription's ID.

Formatuuid

Header Parameters

FlexMalipo-Version?"2026-11-06"

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"
Idempotency-Key?string

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.

Match^[\x21-\x7E]+$
Length1 <= length <= 255

Request 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 POST "https://api-malipo.flex.co.tz/api/v1/subscriptions/497f6eca-6276-4993-bfeb-53cbbbba6f08/change-preview" \  -H "Authorization: Bearer <token>" \  -H "FlexMalipo-Version: 2026-11-06" \  -H "Idempotency-Key: 5f1c1e0a-3b7e-4c8e-9d1a-2f6b8a4c7e11" \  -H "Content-Type: application/json" \  -d '{}'
{  "timing": "now",  "proration": "create_prorations",  "currency": "TZS",  "lines": [    {      "type": "next_invoice",      "amount": 6774,      "description": "Difference for the current period and the periods paid ahead, added to the next invoice"    }  ],  "creditsApplied": 0,  "amountDue": 0,  "paidThrough": "2019-08-24T14:15:22Z",  "nextRenewalAt": "2019-08-24T14:15:22Z",  "nextRenewalAmount": 20000,  "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"    }  ],  "quoteId": "string",  "quoteExpiresAt": "2019-08-24T14:15:22Z"}