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
Responses
- 204
- 400
- 404
- 500
Success. The subscription's state has changed.
Bad request. The request failed validation.
Not found. The requested entity does not exist.
Internal server error. There was a system failure in the platform.
Authorization: http
name: BearerTokentype: httpscheme: bearer
- csharp
- curl
- dart
- go
- http
- java
- javascript
- kotlin
- c
- nodejs
- objective-c
- ocaml
- php
- powershell
- python
- r
- ruby
- rust
- shell
- swift
- HTTPCLIENT
- RESTSHARP
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, "https://euwest.api.elasticpath.com/v2/subscriptions/subscriptions/:subscription_uuid/states");
request.Headers.Add("Authorization", "Bearer <token>");
var content = new StringContent("{\n \"data\": {\n \"type\": \"subscription_state\",\n \"attributes\": {\n \"action\": \"cancel\"\n }\n }\n}", null, "application/json");
request.Content = content;
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
Console.WriteLine(await response.Content.ReadAsStringAsync());
ResponseClear