v1

latestOpenAPI 3.1.02026-07-241080412.6 KB

Switch subscription

This endpoint is used to upgrade or downgrade a subscription to another subscription plan. Use either subscriptionId OR customerId and fromOfferId together (customerId and fromOfferId can only be used with Cleeng-managed subscriptions where the whole lifecycle is under the control of Cleeng). As these last two parameters are deprecated, subscriptionId is going to be the only option to use this endpoint. <br> <br> Important <br>Subscription upgrade and downgrade feature requires compatibility of the payment connector and payment gateway. Currently the feature is fully supported for the following: Adyen, PayPal. Please contact Cleeng Support Team if you wish to use other payment connectors/gateways.

post/subscription_switches

Headers

Content-Typestring
X-Publisher-Tokenstring required

Request body

subscriptionIdinteger

Subscription identifier at Cleeng. This is the ID of the subscription the customer is switching from. Required conditionally when customerId and fromOfferId not provided.

toOfferIdstring required

ID of the subscription offer to which a customer wants to upgrade

switchDirectionstring required

Supported: upgrade, downgrade, unspecified. Note: unspecified is only supported for externally-managed subscriptions (subscriptions whose life cycle is managed outside of Cleeng).

algorithmstring

Supported: DEFERRED, IMMEDIATE_WITHOUT_PRORATION. Required conditionally if the subscription is externally-managed (<<glossary:externally-managed subscriptions>>, e.g. managed in an app store, outside of Cleeng).

customerIdinteger

Cleeng ID of a customer. Deprecated.

fromOfferIdstring

Offer ID of a customer’s subscription that will be upgraded. Deprecated.

Response

200

successboolean
messagestring

Example response

{
  "success": true,
  "data": {
    "id": "240fd50f-f0ac-430e-b3d0-97b2b57690ea",
    "customerId": 111222333,
    "direction": "downgrade",
    "algorithm": "DEFERRED",
    "fromOfferId": "S123123123_PL",
    "toOfferId": "S321321321_PL",
    "subscriptionId": "123456789",
    "status": "pending",
    "createdAt": 1661337280,
    "updatedAt": 1661337280
  },
  "message": "Offer downgrade requested"
}