Cancel product
/accounts/cancel_product
Target audience: Developers
Cancel 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/accounts/cancel_product |
Production |
https://backend.worldoftulo.com/external/api/v1/accounts/cancel_product |
Requirements
Identity |
Scope |
No |
/external/account/w |
Parameters
Name |
Required |
Type |
Description |
id |
Required |
String |
The id of the account to get information about. Size range: ..24 Allowed values: "/^[a-f\d]{24}$/i" |
user_product_id |
Required |
String |
The id of the user product to cancel |
cancellation_reason_id |
Optional |
String |
The 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/accounts/cancel_product \
--header 'accept: application/json' \
--header 'authorization: Bearer <token>' \
--header 'content-type: application/json' \
--data '{
"id": "585a4768edce2c5e6f000001",
"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 404 Not Found
Name |
Type |
Description |
not_found |
Object |
The account could not be found |
HTTP 500 Internal Server Error
Name |
Type |
Description |
internal_server_error |
Object |
Something unexpected happened server side |