Skip to content

Cancel payway-provisioned subscription

/subscription_system/cancel_payway_provisioned_subscription

Target audience: Developers

Release version: 4.1.6

Cancel payway provisioned subscription

Introduction

This endpoint cancelling a single user product by id. It will put the user product in the cancelled state, which means it will be deactivated upon next renewal date.

Prerequisites and Constraints

  • The user product must be controlled by Payway (provision_service == tulo)
  • The package of the user product is configured to allow the user to cancel it. This is administered in PAP package administration.
  • The user product must be recurring (subscription_type != limited)

URI

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

Requirements

Identity Scope
No /external/subscription_system/w

Parameters

Field Required Description
account_id Required id of the account
user_product_id Required id of the user product to cancel
cancellation_reason_id Optional id of the cancellation reason to supply. Defaults to default cancellation reason if omitted.

Curl Example

curl --request PUT \
  --url https://payway-api.stage.adeprimo.se/external/api/v1/subscription_system/cancel_payway_provisioned_subscription \
  --header 'accept: application/json' \
  --header 'authorization: Bearer token' \
  --header 'content-type: application/json' \
  --data '{
  "account_id": "50f3ac249f6aef294d000007"
  "user_product_id": "50f3ac249f6aef294d000007"
  "cancellation_reason_id": "24f26283220c48af88ebf2a8"
}'

Response

Field Description
id id of the cancelled user product

Example Response

HTTP 200
{
    "id": "50f3ac249f6aef294d000007"
}

Errors

Example error response

HTTP 400 Bad Request
{
    "code": "invalid_parameter",
    "field": "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_tulo_provisioned Object The product is not controlled by Payway and can not be reactivated
invalid_state Object The product is not activate and can not be cancelled
user_product_not_belong_to_account Object The product is not associated with the current account and the operation is therefore forbidden

HTTP 500 Internal Server Error

Name Type Description
internal_server_error Object Something unexpected happened server side