Change product
Target audience: Developers
Upgrade/downgrade subscription¶
Introduction¶
This endpoint lets you request a package change on an ongoing subscription. There are a number of requirements to take into account when using this functionality, which you can read more about here.
Behaviours¶
While performing/requesting a package change, there are two possible behaviours.
Default behaviour¶
Package changes/requests will typically be performed as either an upgrade or a downgrade. By default, this decision 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 should be handled as 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/change_product |
Production | https://backend.worldoftulo.com/external/api/v1/me/change_product |
Requirements¶
Identity | Scope |
---|---|
Yes | /external/me/w |
Parameters¶
Field | Required | Type | Description |
---|---|---|---|
id | Optional | String | The id of the user product to change product on. Size range: ..24 Allowed values: "/^[a-f\d]{24}$/i" |
package_code | Optional | String | The package_code of the package to upgrade/downgrade into. Size range: 1..50 |
target_period_id | Optional | String | The id of the period to transition to. If none is specified, we will attempt to find one based on the current payment method and a period length of 1 month. Size range: ..24 Allowed values: "/^[a-f\d]{24}$/i" Release version 4.4.9 |
Curl Example¶
curl --request PUT \
--url https://payway-api.stage.adeprimo.se/external/api/v1/me/change_product \
--header 'accept: application/json' \
--header 'authorization: Bearer token' \
--header 'content-type: application/json' \
--data '{
"id": "50f3ac249f6aef294d000007",
"package_code": "adeprimo_premium_extra_large",
"target_period_id": "37f3ac249f6aef294d337357"
}'
Response¶
Field | Description |
---|---|
id | The id of the new user product. |
HTTP 200 Updated
{
"id": "50f3ac249f6aef294d000007"
}
Errors¶
This API uses the common error conventions of the Payway API