Products
Products represent items or services that customers can purchase. They can be one-time purchases or subscription-based with different frequency options.
The Product Object
id string
name string
The name of the product
description string | null
Optional description of the product
price string
The price of the product in decimal format
purchaseFrequency enum
How often the user is charged for the product. Options:
ONCE- Charged once. Used for on-demand purchases.WEEKLY- Charged weeklyMONTHLY- Charged monthlyYEARLY- Charged yearly
deliveryCadence enum | null
How often the product is delivered after purchase (for recurring products). Options:
DAILY- Delivered dailyWEEKLY- Delivered weeklyMONTHLY- Delivered monthlyYEARLY- Delivered yearly
stripeProductId string | null
Eventually consistent id from Stripe
stripePriceId string | null
Eventually consistent id from Stripe
rules ProductRule[]
createdAt string
ISO 8601
updatedAt string
ISO 8601
deletedAt string | null
ISO 8601, present only if the product has been soft-deleted
Create a Product
- TypeScript / JavaScript
let oneTimeProduct = await solidtx.products.create({
name: 'Mega Gem Package',
price: '25.00',
purchaseFrequency: 'ONCE'
})
let subscriptionProduct = await solidtx.products.create({
name: 'Gem Subscription',
price: '10.00',
purchaseFrequency: 'MONTHLY',
deliveryCadence: 'MONTHLY'
})
Parameters
name stringRequired
The name of the product
price stringRequired
The price of the product
purchaseFrequency enumRequired
How often the user is charged for the product: ONCE, WEEKLY, MONTHLY, or YEARLY
description string
Optional description of the product
deliveryCadence enum
For recurring products, how often it's delivered: DAILY, WEEKLY, MONTHLY, or YEARLY. Only nullable if purchaseFrequency is ONCE.
Returns
Returns the Product you just created.
{
"id": "product_01234567890abcdef",
"name": "Gem Subscription",
"description": "Get 1000 gems monthly",
"price": "10.00",
"purchaseFrequency": "MONTHLY",
"deliveryCadence": "MONTHLY",
"stripeProductId": "prod_Nq123456",
"stripePriceId": "price_Nq123456",
"createdAt": "2025-05-01T12:00:00Z",
"updatedAt": "2025-05-01T12:00:00Z",
"deletedAt": null,
"rules": [
{
"id": "pr_01234567890abcdef",
"event": "ProductPurchased",
"action": "AddBalance",
"amount": "1000",
"balanceId": "gems"
}
]
}
Deactivate a Product
- TypeScript / JavaScript
let product = await solidtx.products.deactivate('product_01234567890abcdef')
Returns
Returns the Product you just deactivated.
{
"id": "product_01234567890abcdef"
}