Skip to content

Change renewal date

/subscription/change_renewal_date

Target audience: Developers

Change renewal date

Introduction

This endpoint lets you change renewal date on a tulo-provisioned user product.

URI

Environment URI
Stage https://payway-api.stage.adeprimo.se/external/api/v1/subscription/change_renewal_date
Production https://backend.worldoftulo.com/external/api/v1/subscription/change_renewal_date

Requirements

Identity Scope
No /external/subscription/w

The user_product referenced must:

  • be tulo-provisioned
  • be active, cancelled or frozen
  • have a valid_to date set previously
  • have a valid_to that is more than 24 hours away

Parameters

Name Type Required Description
user_product_id String Required The id of the user product to update
add_days String Optional Number of days to add (positive number)
remove_days String Optional Number of days to remove (positive number)
valid_to_date String Optional Specific date, format YYYY-MM-DD
requested_by String Optional Default: 'external_api'

Curl Example

curl --request PUT \
  --url https://payway-api.stage.adeprimo.se/external/api/v1/subscription/change_renewal_date \
  --header 'accept: application/json' \
  --header 'authorization: Bearer token' \
  --header 'content-type: application/json' \
  --data '{
    "user_product_id": "50f3ac249f6aef294d000007",
    "valid_to_date": "2020-04-01",
    "requested_by": "Payway Admin"
  }'

Response

Field Description
id id of the user_product
new_valid_to The new expiration date

Example Response

HTTP 200
{
    "id": "50f3ac249f6aef294d000007",
    "new_valid_to": "2020-04-01T08:36:08+02:00"
}

Errors

Bad request

HTTP 400 Bad request
{
  "code": "invalid_parameter",
  "field": "add_days",
  "message": "Must be a positive number"
}

Invalid parameter

HTTP 409 Conflict
{
  "code": "invalid_parameter",
  "field": [
    "add_days",
    "remove_days",
    "valid_to_date"
  ],
  "message": "One of parameters [add_days, remove_days, valid_to_date] is required"
}

Invalid parameter

This will occur if the referenced user-product is not provisioned by Tulo or it has a status that is not one of activated, cancelled, pending or frozen.

HTTP 409 Conflict
{
  "code": "must_be_tulo_provisioned_and_cancelled_or_frozen",
  "field": "unspecified_field",
  "message": "must be tulo provisioned and active, cancelled or frozen"
}

Invalid parameter

This will occur if the referenced user-products' valid_to date is less than 24 hours from now.

HTTP 409 Conflict
{
  "code": "change_renewal_date_one_day_before_valid_to",
  "field": "unspecified_field",
  "message": "cannot modify valid_to less than 24 hours prior to subscription expiration"
}

HTTP 500 Internal Server Error

Name Type Description
internal_server_error Object Something unexpected happened server side