Skip to main content

Create a subscription state

POST 

https://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:

Request

Path Parameters

    subscription_uuid UUIDrequired

    The unique identifier of the subscription.

Body

    data ChangeStaterequired
    typeSubscriptionStateType (string)required

    This represents the type of resource object being returned. Always subscription_state.

    Possible values: [subscription_state]

    Example: subscription_state
    attributes SubscriptionStateAttributesrequired
    actionSubscriptionStateAction (string)required

    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; canceled, paused, or resumed.

    See Managing the subscription lifecycle.

    Possible values: [cancel, pause, resume, pending]

    Example: cancel

Responses

Success. The subscription's state has changed.

Authorization: http

name: BearerTokentype: httpscheme: bearer
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());
Request Collapse all
Base URL
https://euwest.api.elasticpath.com/v2
Auth
Parameters
— pathrequired
Body
{
  "data": {
    "type": "subscription_state",
    "attributes": {
      "action": "cancel"
    }
  }
}
ResponseClear

Click the Send API Request button above and see the response here!