Skip to content

Get available product changes

/me/available_product_changes

Target audience: Developers

Release version: 4.11.4

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.

Compared to version 1, each upgrade and downgrade is an object that tells whether the change requires a delivery address, and packages with a print product are also listed when the subscription has no delivery address.

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

Packages can 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.

Packages with a print product

A package that includes a print product needs a delivery address on the subscription. If the subscription has no delivery address, for example one that was bought as digital-only, the package is still listed, with requires_delivery_address set to true. Give the address with delivery_address when calling change product.

URI

Environment URI
Stage https://payway-api.stage.adeprimo.se/external/api/v2/me/available_product_changes
Production https://backend.worldoftulo.com/external/api/v2/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. The user product must belong to the logged in account.
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.

Curl Example

curl --request GET \
  --url https://payway-api.stage.adeprimo.se/external/api/v2/me/available_product_changes?id=50f3ac249f6aef294d000007&product_codes=print_package,expensive_package,cheaper_package \
  --header 'accept: application/json' \
  --header 'authorization: Bearer token'

Response

Field Description
upgrades The packages/campaigns available for upgrade, see the fields below
downgrades The packages/campaigns available for downgrade, see the fields below

Each upgrade and downgrade has these fields:

Field Description
product_code The product code of the package or campaign
requires_delivery_address True if the package has a print product and the subscription has no delivery address. Give the address with delivery_address in change product.
HTTP 200 OK
{
  "item": {
    "upgrades": [
      { "product_code": "print_package", "requires_delivery_address": true },
      { "product_code": "expensive_package", "requires_delivery_address": false }
    ],
    "downgrades": [
      { "product_code": "cheaper_package", "requires_delivery_address": false }
    ]
  }
}

Errors

This API uses the common error conventions of the Payway API

See common error responses