Get available product changes
Target audience: Developers
Release version: 4.3.11
Get available product changes¶
Introduction¶
This endpoint lets you check if a subscription can either be upgraded or downgraded to requested packages/campaigns. Read more on upgrading and downgrading a subscription here.
Behaviours¶
While fetching possible upgrades/downgrades from the available product changes endpoints, there are two possible behaviours.
Default behaviour¶
By default, upgrades and downgrades will be based upon the payment period prices. If the customer would land on a more expensive period, we'll see it as an upgrade. If the customer would land on a cheaper period, we'll see it as a downgrade.
Rank-based behaviour¶
Introduced in Payway 4.5.3, packages can now be ranked in PAP. This means that the ranking of packages will be used instead of the payment period prices to decide whether it is an upgrade or downgrade (granted a ranking exists on both the source and target package). More on how Ranks work in Payway can be read upon here.
URI¶
Environment | URI |
---|---|
Stage | https://payway-api.stage.adeprimo.se/external/api/v1/me/available_product_changes |
Production | https://backend.worldoftulo.com/external/api/v1/me/available_product_changes |
Requirements¶
Identity | Scope |
---|---|
Yes | /external/me/r |
Parameters¶
Field | Required | Type | Description |
---|---|---|---|
id | Required | String | The id of the user product to change from. Size range: ..24 Allowed values: "/^[a-f\d]{24}$/i" |
product_codes | Required | String | The product codes of the packages/campaigns to check. Up to 5 product codes are allowed, and if more are given, the rest will be ignored. Size range: 1..1024 |
has_custom_target_period | Optional | Boolean | Set to true if you would like to include all products containing periods with a matching payment option. Leave blank or set to false if you would only like to include products containing periods with a matching payment option and length. Release version 4.4.9 |
Curl Example¶
curl --request GET \
--url https://payway-api.stage.adeprimo.se/external/api/v1/me/available_product_changes?id=50f3ac249f6aef294d000007&product_codes=expensive_package,expensive_campaign,cheaper_package,cheaper_campaign,even_cheaper_package,same_code_as_current_subscription&has_custom_target_period=false\
--header 'accept: application/json' \
--header 'authorization: Bearer token' \
Response¶
Field | Description |
---|---|
upgrades | The product codes available for upgrade |
downgrades | The product codes available for downgrade |
HTTP 200 OK
{
"item": {
"upgrades": [
"expensive_package",
"expensive_campaign"
],
"downgrades": [
"cheaper_package",
"cheaper_campaign",
"even_cheaper_package"
]
}
}
Errors¶
This API uses the common error conventions of the Payway API