Skip to content

/change_product

/me/change_product

Target audience: Developers

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:

  • Source subscription must be limited or recurring
  • Source subscription must be Reactivate
  • Source subscription must be tulo-provisioned
  • Source subscription package must not be the same as target package
  • Source subscription package must not have an integration code
  • Target package must be recurring
  • Target package must not have an integration code
  • Target package must have a payment period that matches a period on the source subscription package

In the case of a Downgrade, Source package must be recurring When successfully changing a package one of two things will happen:

  1. If the source package is less expensive than the target package an upgrade will occur.
  2. If the target package is less expensive than the source package a downgrade will occur.

An upgrade will take place immediately and the account will have the new package provisioned on the account right away, with its valid_to re-calculated based on the difference in cost between the packages.

A downgrade will result in a "Package Downgrade Request", and the package will be downgraded at the end of the current subscription period, when the next renewal happens.

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

Required scope

1
/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

Curl Example

1
2
3
4
5
6
7
8
9
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"
          }'

Response

Field Description
id The unique id of the reactivated user product.

Example Response: Successfully accepted shared subscription

1
2
3
4
HTTP 200 Updated
{
    "id": "50f3ac249f6aef294d000007"
}

Errors

Example error response

1
2
3
4
5
6
HTTP 400 Bad Request
{
    "code": "invalid_parameter",
    "field": "account_id",
    "message": "Parameter must match format (/^[a-f\d]{24}$/)"
}

HTTP 400 Bad Request

Name Type Description
invalid_parameter Object Validation error on any of the fields in the posted json
json_parser_error Object The request body could not be parsed as valid json
invalid_content_type_error Object The requests Content-Type header isn't set to application/json
unknown_parameter Object One or more of the fields in the posted json was not recognized

HTTP 404 Not Found

Name Type Description
not_found Object The account or product could not be found

HTTP 409 Conflict

Name Type Description
user_product_not_activated Object The source subscription is not active
user_product_not_tulo_provisioned Object The target subscription has provision_service other than 'tulo'
not_supported_error Object These are errors that should only occur during implementation. Please read error message in the response payload to get details.

HTTP 500 Internal Server Error

Name Type Description
internal_server_error Object Something unexpected happened server side