Products & Features
आप क्या बेचते हैं, यह define करें। एक या अधिक variants के साथ products बनाएं, entitlement-based access control के लिए reusable features जोड़ें।
Proyecta Commerce तीन concepts का उपयोग करता है: products, variants, और features।
- Product — वह चीज़ जो आप बेचते हैं (जैसे “Pro Plan”, “T-shirt”, “Strategy Call”)
- Variant — किसी product की एक pricing tier या configuration (जैसे “Pro Monthly $29”, “Pro Annual $290”, “T-shirt – Large”)
- Feature — एक reusable entitlement key जिसे आपका app runtime पर check करता है (जैसे
pro_features,unlimited_projects,api_access)
एक product के कई variants हो सकते हैं। किसी product में एक या अधिक resources भी जुड़े होते हैं — आमतौर पर features — जो customer के subscribe करने पर access प्रदान करते हैं।
Product बनाना
Section titled “Product बनाना”Dashboard > Commerce > Products में जाकर Create product पर क्लिक करें (या AI से पूछें: "Create a Pro plan at $29/month and a Business plan at $99/month.")। हर product के लिए ये चीज़ें ज़रूरी हैं:
- एक display name (जैसे “Pro”)
- कम से कम एक variant
Variants
Section titled “Variants”हर variant की अपनी pricing होती है:
| Field | Notes |
|---|---|
name | Variant का display label (“Monthly”, “Annual”, “Large”) |
currency | तीन अक्षरों का ISO code — USD, EUR, GBP, JPY, BRL, MXN, INR… (SDK 130+ को support करता है) |
unit_amount | सबसे छोटी currency unit (cents) में price। 2900 = $29.00 |
recurring | Optional — { interval: 'week' | 'month' | 'year' }। One-time prices के लिए इसे छोड़ दें। Daily billing फ़िलहाल supported नहीं है। |
is_default | Accept किया जाता है लेकिन अभी enforce नहीं होता — default variant selection फ़िलहाल implement नहीं हुआ है। |
media | CDN file ID द्वारा images या videos जोड़ें (देखें Files) |
Pricing immutable होती है। एक बार variant बन जाने के बाद उसकी price नहीं बदली जा सकती — इसके बजाय एक नया variant बनाएं। यह existing subscribers को accidental price changes से बचाता है।
Features (entitlements)
Section titled “Features (entitlements)”Features access-control का मूल आधार हैं। एक feature एक बार बनाएं, फिर उसे एक या अधिक products से जोड़ें।
// Create a featureconst pro = await proyecta.commerce.features.create({ name: 'Pro features', description: 'Unlocks the Pro tier capabilities', // optional custom id — lowercase alphanumeric and underscores only (e.g. 'pro_features')});जब आप कोई product बनाते हैं, तो आप “resources” के ज़रिए उसमें features जोड़ते हैं। जो customers किसी product को subscribe करते हैं, उन्हें उससे जुड़े हर feature का access मिल जाता है।
फिर अपने app में check करें कि किसी customer के पास access है या नहीं:
const { has_access } = await proyecta.commerce.check({ customer_id: 'cus_123', resource_id: 'pro_features',});Note:
resource_idfeature की key होनी चाहिए — यानी feature name से बना slug (जैसेpro_features), न किfeatures.create()द्वारा return किए गए feature object की.idproperty।
इसी तरह आप अपने app code में Pro-only pages, API endpoints, या features को gate करते हैं।
सामान्य product shapes
Section titled “सामान्य product shapes”SaaS subscriptions
Create products: Free ($0/month), Pro ($29/month, $290/year), Business ($99/month, $990/year).Attach a 'pro_features' feature to Pro and Business so I can gate access in my code.Physical goods
Create a T-shirt product with three variants: Small, Medium, Large at $25 each.Digital goods
Create a course product with a single one-time variant at $149.Donations
Create a donation product with three variants: $25, $50, $100 — all one-time.Inventory
Section titled “Inventory”Proyecta Commerce फ़िलहाल physical products के लिए inventory track नहीं करता। अगर आप stocked items बेचते हैं, तो stock counts अपने app के database में manage करें और अपने checkout flow में उन्हें check करें।
जल्द आने वाला
Section titled “जल्द आने वाला”- Checkout field customization — buyers से अतिरिक्त जानकारी collect करें
- Pay-what-you-want pricing
- Physical products के लिए Built-in inventory tracking