Create a subscription state
POSThttps://euwest.api.elasticpath.com/v2/subscriptions/subscriptions/:subscription_uuid/states
The subscription lifecycle is the states that a subscription can go through when a customer subscribes to a service or a product.
A subscription can have the following states:
pending
canceled
paused
resumed
For more information, see Managing the Subscription Lifecycle.
Request
Path Parameters
subscription_uuid UUIDrequired
The unique identifier of the subscription.
- application/json
Body
data ChangeStaterequired
Responses
- 204
- 400
- 404
- 500
Success. The subscription's state has changed.
Bad request. The request failed validation.
- application/json
- Schema
- Example (from schema)
- missing-name
Schema
errors Error[]required
{
"errors": [
{
"status": 500,
"title": "Internal server error",
"detail": "An internal error has occurred.",
"meta": {
"missing_ids": [
"e7d50bd5-1833-43c0-9848-f9d325b08be8"
]
}
}
]
}
{
"errors": [
{
"title": "Validation Error",
"status": "400",
"detail": "data.attributes.name: \"name\" is required"
}
]
}
Not found. The requested entity does not exist.
- application/json
- Schema
- Example (from schema)
- not-found
Schema
errors Error[]required
{
"errors": [
{
"status": 500,
"title": "Internal server error",
"detail": "An internal error has occurred.",
"meta": {
"missing_ids": [
"e7d50bd5-1833-43c0-9848-f9d325b08be8"
]
}
}
]
}
{
"errors": [
{
"title": "Not Found",
"status": "404",
"detail": "No plan found"
}
]
}
Internal server error. There was a system failure in the platform.
- application/json
- Schema
- Example (from schema)
- internal-server-error
Schema
errors Error[]required
{
"errors": [
{
"status": 500,
"title": "Internal server error",
"detail": "An internal error has occurred.",
"meta": {
"missing_ids": [
"e7d50bd5-1833-43c0-9848-f9d325b08be8"
]
}
}
]
}
{
"errors": [
{
"title": "Internal Server Error",
"status": "500"
}
]
}
Authorization: http
name: BearerTokentype: httpscheme: bearer
- curl
- python
- go
- nodejs
- ruby
- csharp
- php
- java
- powershell
- CURL
curl -L -X POST 'https://euwest.api.elasticpath.com/v2/subscriptions/subscriptions/:subscription_uuid/states' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer <TOKEN>' \
--data-raw '{
"data": {
"type": "subscription_state",
"attributes": {
"action": "cancel"
}
}
}'
ResponseClear