Add a Product Price to a Price Book
POSThttps://euwest.api.elasticpath.com/pcm/pricebooks/:pricebookID/prices
Price books contain prices for the products in your catalog. Use the Prices API to adds the prices for a product to a specified price book. If the prices for the product already exist in the price book, the operation fails and the existing product prices are not updated.
Request
Responses
- 201
- default
A product price with the following attributes.
Unexpected error.
Authorization: Authorization
name: Authorizationtype: httpin: headerscheme: 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/pcm/pricebooks/:pricebookID/prices");
request.Headers.Add("Accept", "application/json");
request.Headers.Add("Authorization", "Bearer <Authorization>");
var content = new StringContent("{\n \"data\": {\n \"type\": \"product-price\",\n \"attributes\": {\n \"currencies\": {\n \"USD\": {\n \"amount\": 100,\n \"includes_tax\": false,\n \"tiers\": {\n \"min_5\": {\n \"minimum_quantity\": 5,\n \"amount\": 50\n }\n }\n },\n \"CAD\": {\n \"amount\": 127,\n \"includes_tax\": false,\n \"tiers\": {\n \"min_10\": {\n \"minimum_quantity\": 10,\n \"amount\": 100\n }\n }\n },\n \"GBP\": {\n \"amount\": 73,\n \"includes_tax\": true,\n \"tiers\": {\n \"min_20\": {\n \"minimum_quantity\": 20,\n \"amount\": 60\n }\n }\n }\n },\n \"sku\": \"product-sku-a\",\n \"sales\": {\n \"summer\": {\n \"schedule\": {\n \"valid_form\": \"2023-12-24T09:00:00\",\n \"valid_to\": \"2023-12-25T09:00:00\"\n },\n \"currencies\": {\n \"USD\": {\n \"amount\": 90,\n \"includes_tax\": false,\n \"tiers\": {\n \"min_5\": {\n \"minimum_quantity\": 5,\n \"amount\": 40\n }\n }\n },\n \"CAD\": {\n \"amount\": 117,\n \"includes_tax\": false,\n \"tiers\": {\n \"min_10\": {\n \"minimum_quantity\": 10,\n \"amount\": 80\n }\n }\n },\n \"GBP\": {\n \"amount\": 65,\n \"includes_tax\": true,\n \"tiers\": {\n \"min_20\": {\n \"minimum_quantity\": 20,\n \"amount\": 50\n }\n }\n }\n }\n }\n },\n \"external_ref\": \"a-external-ref\",\n \"admin_attributes\": {\n \"cost_of_goods\": \"42.0\",\n \"charge_type\": \"credit card\"\n },\n \"shopper_attributes\": {\n \"cost_of_goods\": \"42.0\",\n \"charge_type\": \"credit card\"\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