Can cancel subscription
/subscription_system/can_cancel_subscription
Target audience: Developers
Can cancel subscription¶
Introduction¶
Check whether an external subscription system provisioned subscription can be cancelled. This endpoint can be used to determine if a cancellation is possible before presenting the option to the end user.
URI¶
| Environment | URI |
|---|---|
| Stage | https://payway-api.stage.adeprimo.se/external/api/v1/subscription_system/can_cancel_subscription |
| Production | https://backend.worldoftulo.com/external/api/v1/subscription_system/can_cancel_subscription |
Requirements¶
| Identity | Scope |
|---|---|
| No | /external/subscription_system/r |
Parameters¶
| Field | Required | Type | Description |
|---|---|---|---|
| account_id | Required | String | The account id for the account that owns the subscription. Size range: ..24 Allowed values: "/^[a-f\d]{24}$/i" |
| user_product_id | Required | String | The id of the subscription to check. Size range: ..24 Allowed values: "/^[a-f\d]{24}$/i" |
Curl Example¶
curl --request GET \
--url https://payway-api.stage.adeprimo.se/external/api/v1/subscription_system/can_cancel_subscription \
--header 'accept: application/json' \
--header 'authorization: Bearer token' \
--header 'content-type: application/json' \
--data '{
"account_id": "5cb804811d41c82b5c518ea1",
"user_product_id": "5cb804811d41c82b5c518ea2"
}'
Response¶
| Field | Description |
|---|---|
| can_cancel | Whether the subscription can be cancelled. true or false |
| reason | The reason why cancellation is not possible. null when can_cancel is true |
Possible reason values¶
| Reason | Description |
|---|---|
| no_account_id | No account id was provided |
| no_user_product_id | No user product id was provided |
| account_not_found | The account was not found |
| account_does_not_belong_to_organisation | The account does not belong to the current organisation |
| no_customer_number | The account does not have a customer number |
| user_product_not_found | The subscription was not found |
| user_product_does_not_belong_to_organisation | The subscription does not belong to the current organisation |
| no_subscription_number | The subscription does not have a subscription number |
| no_external_service | No external subscription system service is configured |
| not_web_originated | The subscription did not originate from the web |
Example Response: Subscription can be cancelled¶
HTTP 200 OK
{
"item": {
"can_cancel": true,
"reason": null
}
}
Example Response: Subscription cannot be cancelled¶
HTTP 200 OK
{
"item": {
"can_cancel": false,
"reason": "not_web_originated"
}
}
Errors¶
This API uses the common error conventions of the Payway API