The "Create Price for a Product" API allows adding a new price associated with a specific product to the system. Use this endpoint to create a price with the specified details for a particular product. Ensure that the required information is provided in the request payload.
POST https://services.leadconnectorhq.com/products/{productId}/priceAuthorization
| Name | Type | Required | Example | Description |
|---|---|---|---|---|
Authorization | string | Yes | Bearer token generated from the Leadway portal. See Authentication. | |
Version | string | Yes | 2021-07-28 | API version. |
Path parameters
| Name | Type | Required | Example | Description |
|---|---|---|---|---|
productId | string | Yes | 6578278e879ad2646715ba9c | ID of the product that needs to be used |
Body
| Name | Type | Required | Example | Description |
|---|---|---|---|---|
name | string | Yes | Price Name | The name of the price. |
type | string | Yes | one_time | The type of the price. Possible values: 'one_time', 'recurring' |
currency | string | Yes | USD | The currency of the price. |
amount | number | Yes | 99.99 | The amount of the price. ( min: 0 ) |
recurring | object | No | The recurring details of the price (if type is recurring). | |
description | string | No | A brief description of the price. |
membershipOffers(object[]): An array of membership offers associated with the price.label(string, required): Membership offer label Example:top_50value(string, required): Membership offer label Example:50_id(string, required): The unique identifier for the membership offer. Example:655b33aa2209e60b6adb87a7
| Name | Type | Required | Example | Description |
|---|---|---|---|---|
trialPeriod | number | No | 7 | The trial period duration in days (if applicable). |
totalCycles | number | No | 12 | The total number of billing cycles for the price. ( min: 1 ) |
setupFee | number | No | 10.99 | The setup fee for the price. |
variantOptionIds | string[] | No | An array of variant option IDs associated with the price. | |
compareAtPrice | number | No | 19.99 | The compare at price for the price. |
locationId | string | Yes | 6578278e879ad2646715ba9c | The unique identifier of the account associated with the price. |
userId | string | No | 6578278e879ad2646715ba9c | The unique identifier of the user who created the price. |
meta | object | No | Additional metadata associated with the price. | |
trackInventory | boolean | No | True | Need to track inventory stock quantity |
availableQuantity | number | No | 5 | Available inventory stock quantity |
allowOutOfStockPurchases | boolean | No | True | Continue selling when out of stock |
sku | string | No | sku_123 | The unique identifier of the SKU associated with the price |
shippingOptions | object | No | Shipping options of the Price | |
isDigitalProduct | boolean | No | True | Is the product a digital product |
digitalDelivery | string[] | No | Digital delivery options |
Responses
201 - Successful response
_id(string, required): The unique identifier for the price. Example:655b33aa2209e60b6adb87a7membershipOffers(object[]): An array of membership offers associated with the price.label(string, required): Membership offer label Example:top_50value(string, required): Membership offer label Example:50_id(string, required): The unique identifier for the membership offer. Example:655b33aa2209e60b6adb87a7
variantOptionIds(string[]): An array of variant option IDs associated with the price.locationId(string): The unique identifier for the account. Example:3SwdhCsvxI8Au3KsPJt6product(string): The unique identifier for the associated product. Example:655b33a82209e60b6adb87a5userId(string): The unique identifier for the user. Example:6YAtzfzpmHAdj0e8GkKpname(string, required): The name of the price. Example:Red / Stype(string, required): The type of the price (e.g., one_time). Possible values: 'one_time', 'recurring' Example:one_timecurrency(string, required): The currency code for the price. Example:INRamount(number, required): The amount of the price. Example:199999recurring(object): The recurring details of the price (if type is recurring).createdAt(string): The creation timestamp of the price. Example:2023-11-20T10:23:38.645ZupdatedAt(string): The last update timestamp of the price. Example:2024-01-23T09:57:04.852ZcompareAtPrice(number): The compare-at price for comparison purposes. Example:2000000trackInventory(boolean): Indicates whether inventory tracking is enabled.availableQuantity(number): Available inventory stock quantity Example:5allowOutOfStockPurchases(boolean): Continue selling when out of stock Example:True
{
"_id": "655b33aa2209e60b6adb87a7",
"membershipOffers": [
{
"label": "top_50",
"value": "50",
"_id": "655b33aa2209e60b6adb87a7"
}
],
"variantOptionIds": [
"h4z7u0im2q8",
"h3nst2ltsnn"
],
"locationId": "3SwdhCsvxI8Au3KsPJt6",
"product": "655b33a82209e60b6adb87a5",
"userId": "6YAtzfzpmHAdj0e8GkKp",
"name": "Red / S",
"type": "one_time",
"currency": "INR",
"amount": 199999,
"createdAt": "2023-11-20T10:23:38.645Z",
"updatedAt": "2024-01-23T09:57:04.852Z",
"compareAtPrice": 2000000,
"availableQuantity": 5,
"allowOutOfStockPurchases": true
}400 - Bad Request
{}422 - Unprocessable Entity
{}Example
curl -X POST 'https://services.leadconnectorhq.com/products/YOUR_productId/price' \
-H 'Authorization: Bearer YOUR_TOKEN' \
-H 'Version: 2021-07-28' \
-H 'Content-Type: application/json' \
-d '{
"name": "Price Name",
"type": "one_time",
"currency": "USD",
"amount": 99.99,
"description": "string",
"membershipOffers": [
{
"label": "top_50",
"value": "50",
"_id": "655b33aa2209e60b6adb87a7"
}
],
"trialPeriod": 7,
"totalCycles": 12,
"setupFee": 10.99,
"variantOptionIds": [
"option_id_1",
"option_id_2"
],
"compareAtPrice": 19.99,
"locationId": "6578278e879ad2646715ba9c",
"userId": "6578278e879ad2646715ba9c",
"trackInventory": true,
"availableQuantity": 5,
"allowOutOfStockPurchases": true,
"sku": "sku_123",
"isDigitalProduct": true,
"digitalDelivery": [
"string"
]
}'const response = await fetch('https://services.leadconnectorhq.com/products/YOUR_productId/price', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.LEADWAY_TOKEN}`,
Version: '2021-07-28',
'Content-Type': 'application/json',
},
body: JSON.stringify({"name": "Price Name", "type": "one_time", "currency": "USD", "amount": 99.99, "description": "string", "membershipOffers": [{"label": "top_50", "value": "50", "_id": "655b33aa2209e60b6adb87a7"}], "trialPeriod": 7, "totalCycles": 12, "setupFee": 10.99, "variantOptionIds": ["option_id_1", "option_id_2"], "compareAtPrice": 19.99, "locationId": "6578278e879ad2646715ba9c", "userId": "6578278e879ad2646715ba9c", "trackInventory": true, "availableQuantity": 5, "allowOutOfStockPurchases": true, "sku": "sku_123", "isDigitalProduct": true, "digitalDelivery": ["string"]}),
});
const data = await response.json();import os, requests
response = requests.request(
'POST',
'https://services.leadconnectorhq.com/products/YOUR_productId/price',
headers={
'Authorization': f"Bearer {os.environ['LEADWAY_TOKEN']}",
'Version': '2021-07-28',
'Content-Type': 'application/json',
},
json={"name": "Price Name", "type": "one_time", "currency": "USD", "amount": 99.99, "description": "string", "membershipOffers": [{"label": "top_50", "value": "50", "_id": "655b33aa2209e60b6adb87a7"}], "trialPeriod": 7, "totalCycles": 12, "setupFee": 10.99, "variantOptionIds": ["option_id_1", "option_id_2"], "compareAtPrice": 19.99, "locationId": "6578278e879ad2646715ba9c", "userId": "6578278e879ad2646715ba9c", "trackInventory": true, "availableQuantity": 5, "allowOutOfStockPurchases": true, "sku": "sku_123", "isDigitalProduct": true, "digitalDelivery": ["string"]},
)
data = response.json()<?php
$ch = curl_init('https://services.leadconnectorhq.com/products/YOUR_productId/price');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('LEADWAY_TOKEN'),
'Version: 2021-07-28',
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode({'name': 'Price Name', 'type': 'one_time', 'currency': 'USD', 'amount': 99.99, 'description': 'string', 'membershipOffers': [{'label': 'top_50', 'value': '50', '_id': '655b33aa2209e60b6adb87a7'}], 'trialPeriod': 7, 'totalCycles': 12, 'setupFee': 10.99, 'variantOptionIds': ['option_id_1', 'option_id_2'], 'compareAtPrice': 19.99, 'locationId': '6578278e879ad2646715ba9c', 'userId': '6578278e879ad2646715ba9c', 'trackInventory': true, 'availableQuantity': 5, 'allowOutOfStockPurchases': true, 'sku': 'sku_123', 'isDigitalProduct': true, 'digitalDelivery': ['string']}),
]);
$data = json_decode(curl_exec($ch), true);