Change customer subscription

Moves a subscriber from their current subscription to another one, without asking the customer to enter their card again. Send the target subscription's ID as target_subscription_id.

Mamo charges the customer's saved card the target plan's price minus the unused part of their current period. If the charge succeeds, the customer is subscribed to the target subscription and unsubscribed from the current one, and the response is the new subscriber. If it fails, the customer stays on their current subscription.

Constraints

  • The charge is the target plan's price minus the unused part of the current period. If that amount is below the minimum chargeable amount (or is zero or negative), the call fails with PRORATION_BELOW_MINIMUM. Moving to a cheaper plan therefore only succeeds when little of the current period is left.
  • Both subscriptions must use the same currency.
  • The target subscription must be attached to a payment link. Otherwise the call returns 404.

Error codes

These return 422.

error_codeMessageMeaning
INACTIVE_SUBSCRIBERSubscriber must be active to upgradeThe subscriber is not active.
MISSING_CARDCustomer has no saved card for off-session chargingThe subscriber has no saved card that can be charged without the customer present.
SAME_SUBSCRIPTIONTarget subscription is the same as the current oneThe target is the subscriber's current subscription.
ALREADY_SUBSCRIBEDCustomer is already subscribed to the targetThis card has (or had) a subscriber record on the target subscription, including an unsubscribed one.
CURRENCY_MISMATCHSubscriptions must have the same currency to upgradeThe two subscriptions use different currencies.
PRORATION_BELOW_MINIMUMUpgrade charge amount is below the minimumThe prorated charge is below the minimum chargeable amount: AED 2, USD 0.55, EUR 0.50, GBP 0.50, and 2 in any other currency (for example SAR 2).
CHARGE_FAILEDIncludes the decline reasonThe proration charge was declined.
Recipes
🔁
Bill a customer every month
Open Recipe
Path Params
string
required
Defaults to MPB-SUB-2B3C4D5E6F

Subscription ID (the subscriber's current subscription)

string
required
Defaults to MPB-SUBSCRIBER-2B3C4D5E6F

Subscriber ID

Body Params
string
required

The identifier of the subscription to move the subscriber to. This is the target subscription's identifier, not a numeric id.

Headers
string

A unique key, such as a UUID, that makes it safe to retry this request. Reuse the same key when you retry. See Idempotency.

Responses

429

Too many requests. You sent more than 100 requests in 30 seconds from one IP address. This response has no JSON body. See Rate limits.

500

Unexpected error

Language
Credentials
Header
URL
LoadingLoading…
Response
Click Try It! to start a request and see the response here! Or choose an example:
application/json