Skip to main content
The “Update Price by ID for a Product” API allows modifying information for a specific price associated with a particular product using its unique identifier. Use this endpoint to update details for a single price based on the provided price ID and product ID.
PUT https://services.leadconnectorhq.com/products/{productId}/price/{priceId}

Autorización

Authorization
string
required
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
priceId
string
default:"6578278e879ad2646715ba9c"
required
ID of the price that needs to be returned

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 )
recurring
object
The recurring details of the price (if type is recurring).
description
string
A brief description of the price.
membershipOffers
object[]
An array of membership offers associated with the price.
trialPeriod
number
default:"7"
The trial period duration in days (if applicable).
totalCycles
number
default:"12"
The total number of billing cycles for the price. ( min: 1 )
setupFee
number
default:"10.99"
The setup fee for the price.
variantOptionIds
string[]
An array of variant option IDs associated with the price.
compareAtPrice
number
default:"19.99"
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.
meta
object
Additional metadata associated with the price.
trackInventory
boolean
default:"True"
Need to track inventory stock quantity
availableQuantity
number
default:"5"
Available inventory stock quantity
allowOutOfStockPurchases
boolean
default:"True"
Continue selling when out of stock
sku
string
default:"sku_123"
The unique identifier of the SKU associated with the price
shippingOptions
object
Shipping options of the Price
isDigitalProduct
boolean
default:"True"
Is the product a digital product
digitalDelivery
string[]
Digital delivery options

Respuestas

_id
string
default:"655b33aa2209e60b6adb87a7"
required
The unique identifier for the price.
membershipOffers
object[]
An array of membership offers associated with the price.
variantOptionIds
string[]
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.
recurring
object
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.
compareAtPrice
number
default:"2000000"
The compare-at price for comparison purposes.
trackInventory
boolean
Indicates whether inventory tracking is enabled.
availableQuantity
number
default:"5"
Available inventory stock quantity
allowOutOfStockPurchases
boolean
default:"True"
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
}
{}
{}
{}

Ejemplo

curl -X PUT 'https://services.leadconnectorhq.com/products/YOUR_productId/price/YOUR_priceId' \
  -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/YOUR_priceId', {
  method: 'PUT',
  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(
    'PUT',
    'https://services.leadconnectorhq.com/products/YOUR_productId/price/YOUR_priceId',
    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/YOUR_priceId');
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_CUSTOMREQUEST => 'PUT',
    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);