Create a plan directly inside an offering
POSThttps://euwest.api.elasticpath.com/v2/subscriptions/offerings/:offering_uuid/plans
After saving an offering, you can add new plans to it at any time.
Request
Responses
- 201
- 400
- 403
- 404
- 409
- 500
Success. The plan is created.
Bad request. The request failed validation.
Forbidden. The operation is forbidden on this entity.
Not found. The requested entity does not exist.
Write conflict. Unable to perform the operation at this time.
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/offerings/:offering_uuid/plans");
request.Headers.Add("Accept", "application/json");
request.Headers.Add("Authorization", "Bearer <token>");
var content = new StringContent("{\n \"data\": {\n \"type\": \"subscription_offering_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());
ResponseClear