Creates a product.
const response = await client.products.create(
{
code: 'PROD_001',
description: 'Premium subscription service',
paid_by_roles: [{ name: 'buyer' }],
paid_to_roles: [{ name: 'seller' }]
}
);| Name | Description |
|---|---|
codestring, required | Unique product code. |
descriptionstring | Product description. |
paid_by_rolesobject[] | Roles that can pay for the product. Reference roles by |
paid_to_rolesobject[] | Roles that can receive payment for the product. Reference roles by |
| Name | Description |
|---|---|
dataobject | Product object. |
{
"data": {
"id": "product_1234567890",
"workspace_id": "ws_1234567890",
"code": "PROD_001",
"description": "Premium subscription service",
"paid_by_roles": [
{
"name": "buyer",
"id": "role_def123"
}
],
"paid_to_roles": [
{
"name": "buyer",
"id": "role_def123"
}
],
"update_version": 1,
"created": "2024-01-13T00:00:00Z"
}
}Lists all products.
const response = await client.products.list();| Name | Description |
|---|---|
dataobject[] | List of products. |
{
"data": [
{
"id": "product_1234567890",
"workspace_id": "ws_1234567890",
"code": "PROD_001",
"description": "Premium subscription service",
"paid_by_roles": [
{
"name": "buyer",
"id": "role_def123"
}
],
"paid_to_roles": [
{
"name": "buyer",
"id": "role_def123"
}
],
"update_version": 1,
"created": "2024-01-13T00:00:00Z"
}
]
}Retrieves a product by code.
const response = await client.products.retrieve('PROD_001');| Name | Description |
|---|---|
codestring, required | Product code. Must not include #, /, or :. |
| Name | Description |
|---|---|
dataobject | Product object. |
{
"data": {
"id": "product_1234567890",
"workspace_id": "ws_1234567890",
"code": "PROD_001",
"description": "Premium subscription service",
"paid_by_roles": [
{
"name": "buyer",
"id": "role_def123"
}
],
"paid_to_roles": [
{
"name": "buyer",
"id": "role_def123"
}
],
"update_version": 1,
"created": "2024-01-13T00:00:00Z"
}
}