Update a subscription
PUThttps://euwest.api.elasticpath.com/v2/subscriptions/subscriptions/:subscription_uuid
Updates a subscription. For example, a subscriber can switch from one plan to another in a subscription.
Request
Responses
- 200
- 400
- 403
- 404
- 500
Success. The subscription is updated.
Bad request. The request failed validation.
Forbidden. The operation is forbidden on this entity.
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.Put, "https://euwest.api.elasticpath.com/v2/subscriptions/subscriptions/:subscription_uuid");
request.Headers.Add("Accept", "application/json");
request.Headers.Add("Authorization", "Bearer <token>");
var content = new StringContent("{\n \"data\": {\n \"id\": \"11111111-2222-3333-4444-555555555555\",\n \"type\": \"subscription\",\n \"attributes\": {\n \"plan_id\": \"00000000-0000-0000-0000-000000000001\",\n \"address_id\": \"00000000-0000-0000-0000-000000000001\",\n \"payment_authority\": {\n \"type\": \"elastic_path_payments_stripe\",\n \"customer_id\": \"cus_OPfKlxWV3hp9h6\",\n \"card_id\": \"card_8Diw3FQPhxK27WADPVMeXieP\"\n },\n \"go_live_after\": \"2017-01-10T11:41:19.244842Z\"\n }\n }\n}", null, "application/json");
request.Content = content;
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
Console.WriteLine(await response.Content.ReadAsStringAsync());
ResponseClear