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}/price
Autorización
Bearer token generado desde el portal Leadway. Ver Autenticación .
Version
string
default: "2021-07-28"
required
Versión de la API.
Path parameters
productId
string
default: "6578278e879ad2646715ba9c"
required
ID of the product that needs to be used
Body
name
string
default: "Price Name"
required
The name of the price.
type
string
default: "one_time"
required
The type of the price. Posibles valores: ‘one_time’, ‘recurring’
currency
string
default: "USD"
required
The currency of the price.
amount
number
default: "99.99"
required
The amount of the price. ( min: 0 )
The recurring details of the price (if type is recurring).
A brief description of the price.
An array of membership offers associated with the price. label
string
default: "top_50"
required
Membership offer label
value
string
default: "50"
required
Membership offer label
_id
string
default: "655b33aa2209e60b6adb87a7"
required
The unique identifier for the membership offer.
The trial period duration in days (if applicable).
The total number of billing cycles for the price. ( min: 1 )
The setup fee for the price.
An array of variant option IDs associated with the price.
The compare at price for the price.
locationId
string
default: "6578278e879ad2646715ba9c"
required
The unique identifier of the account associated with the price.
userId
string
default: "6578278e879ad2646715ba9c"
The unique identifier of the user who created the price.
Additional metadata associated with the price.
Need to track inventory stock quantity
Available inventory stock quantity
Continue selling when out of stock
The unique identifier of the SKU associated with the price
Shipping options of the Price
Is the product a digital product
Respuestas
201 - Successful response
_id
string
default: "655b33aa2209e60b6adb87a7"
required
The unique identifier for the price.
An array of membership offers associated with the price. label
string
default: "top_50"
required
Membership offer label
value
string
default: "50"
required
Membership offer label
_id
string
default: "655b33aa2209e60b6adb87a7"
required
The unique identifier for the membership offer.
An array of variant option IDs associated with the price.
locationId
string
default: "3SwdhCsvxI8Au3KsPJt6"
The unique identifier for the account.
product
string
default: "655b33a82209e60b6adb87a5"
The unique identifier for the associated product.
userId
string
default: "6YAtzfzpmHAdj0e8GkKp"
The unique identifier for the user.
name
string
default: "Red / S"
required
The name of the price.
type
string
default: "one_time"
required
The type of the price (e.g., one_time). Posibles valores: ‘one_time’, ‘recurring’
currency
string
default: "INR"
required
The currency code for the price.
amount
number
default: "199999"
required
The amount of the price.
The recurring details of the price (if type is recurring).
createdAt
string
default: "2023-11-20T10:23:38.645Z"
The creation timestamp of the price.
updatedAt
string
default: "2024-01-23T09:57:04.852Z"
The last update timestamp of the price.
The compare-at price for comparison purposes.
Indicates whether inventory tracking is enabled.
Available inventory stock quantity
Continue selling when out of stock
{
"_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
}
422 - Unprocessable Entity
Ejemplo
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 );