Skip to main content

Create a plan

POST 

https://euwest.api.elasticpath.com/v2/subscriptions/plans

Create a plan

Request

Responses

Success. The subscription plan is created.

Authorization: http

name: BearerTokentype: httpscheme: bearer
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, "https://euwest.api.elasticpath.com/v2/subscriptions/plans");
request.Headers.Add("Accept", "application/json");
request.Headers.Add("Authorization", "Bearer <token>");
var content = new StringContent("{\n \"data\": {\n \"type\": \"subscription_plan\",\n \"attributes\": {\n \"external_ref\": \"abc123\",\n \"name\": \"Monthly\",\n \"description\": \"A monthly subscription.\",\n \"billing_interval_type\": \"month\",\n \"billing_frequency\": 1,\n \"trial_period\": 7,\n \"plan_length\": 12,\n \"end_behavior\": \"close\",\n \"can_pause\": false,\n \"can_resume\": false,\n \"can_cancel\": false,\n \"base_price_percentage\": 90,\n \"fixed_price\": {\n \"USD\": {\n \"amount\": 100,\n \"includes_tax\": false\n },\n \"GBP\": {\n \"amount\": 90,\n \"includes_tax\": true\n }\n }\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
Body
{
  "data": {
    "type": "subscription_plan",
    "attributes": {
      "external_ref": "abc123",
      "name": "Monthly",
      "description": "A monthly subscription.",
      "billing_interval_type": "month",
      "billing_frequency": 1,
      "trial_period": 7,
      "plan_length": 12,
      "end_behavior": "close",
      "can_pause": false,
      "can_resume": false,
      "can_cancel": false,
      "base_price_percentage": 90,
      "fixed_price": {
        "USD": {
          "amount": 100,
          "includes_tax": false
        },
        "GBP": {
          "amount": 90,
          "includes_tax": true
        }
      }
    }
  }
}
ResponseClear

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

We use cookies to enhance your experience. By continuing to visit this site you agree to our use of cookies.