Skip to main content

Create a subscriber

POST 

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

Create a subscriber

Request

Responses

Success. The subscriber 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/subscribers");
request.Headers.Add("Accept", "application/json");
request.Headers.Add("Authorization", "Bearer <token>");
var content = new StringContent("{\n \"data\": {\n \"type\": \"subscription_subscriber\",\n \"attributes\": {\n \"account_id\": \"11111111-2222-3333-4444-555555555555\",\n \"name\": \"John Doe\",\n \"email\": \"john.doe@example.com\",\n \"payment_authority\": {\n \"type\": \"elastic_path_payments_stripe\",\n \"customer_id\": \"cus_OPfKlxWV3hp9h6\",\n \"card_id\": \"card_8Diw3FQPhxK27WADPVMeXieP\"\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
Parameters
— query
Body
{
  "data": {
    "type": "subscription_subscriber",
    "attributes": {
      "account_id": "11111111-2222-3333-4444-555555555555",
      "name": "John Doe",
      "email": "john.doe@example.com",
      "payment_authority": {
        "type": "elastic_path_payments_stripe",
        "customer_id": "cus_OPfKlxWV3hp9h6",
        "card_id": "card_8Diw3FQPhxK27WADPVMeXieP"
      }
    }
  }
}
ResponseClear

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