Customers
अपने ऐप के billable users को manage करें। Dashboard > Commerce > Customers tab में या SDK के ज़रिए।
Customer वह entity होती है जिससे तुम्हारे ऐप में charge किया जाता है — आमतौर पर एक user, एक organization, या एक project। जैसे ही तुम्हारे अपने database में संबंधित entity बनती है, तुम Proyecta में एक customer बनाते हो, और फिर बाद में reference के लिए returned id को store कर लेते हो।
Customers tab
Section titled “Customers tab”Dashboard > Commerce खोलो और Customers tab पर जाओ — वहाँ तुम्हें current app के सभी billable customers दिखेंगे। हर row में ये जानकारी होती है:
- पूरा नाम
- कब बनाया गया
Search box और email या creation date के हिसाब से filtering SDK के ज़रिए उपलब्ध है; panel में और बेहतर controls जल्द आने वाले हैं।
import Proyecta from '@proyecta-ai/sdk';const proyecta = new Proyecta({ apiKey: process.env.PROYECTA_API_KEY });const customer = await proyecta.commerce.customers.create({ email: 'alice@example.com', name: 'Alice Liddell', phone: '+14155551234', // E.164 format address: { line1: '123 Wonderland Ave', city: 'San Francisco', state: 'CA', postal_code: '94110', country: 'US', },});// Single customerconst customer = await proyecta.commerce.customers.get({ customerId: 'cus_123' });
// Paginateconst result = await proyecta.commerce.customers.list({ limit: '20' });for (const customer of result.data) { console.log(customer.name, customer.email);}अपडेट करें
Section titled “अपडेट करें”await proyecta.commerce.customers.update({ customerId: 'cus_123', email: 'new@example.com', address: { ... } });सामान्य patterns
Section titled “सामान्य patterns”जब कोई user sign up करे तो Proyecta customer बनाएँ
When a new user finishes signup, call proyecta.commerce.customers.createwith their email and name. Store the returned id on the user record asproyecta_customer_id.Admin customer browser बनाएँ
Build an admin page at /admin/customers that lists every Proyecta customerwith their email, name, created date, and a link to view their detail page.Use proyecta.commerce.customers.list to paginate through all customers.अक्सर पूछे जाने वाले सवाल
Section titled “अक्सर पूछे जाने वाले सवाल”क्या मुझे हर user के लिए Proyecta customer बनाना चाहिए, या सिर्फ paying users के लिए?
हर user के लिए बनाओ। यह free है, idempotent है (एक ही email से call करने पर वही customer वापस मिलता है), और इसका मतलब है कि जैसे ही कोई user upgrade करे, तुम तैयार हो — बाद में backfill करने की कोई ज़रूरत नहीं।
क्या एक customer के कई subscriptions हो सकते हैं?
हाँ। Subscriptions customers से जुड़े होते हैं, न कि उल्टा। नया subscription checkout session बनाने के लिए commerce.checkout() का इस्तेमाल करो।
मैं कैसे देखूँ कि एक customer किसका subscribe करता है?
अभी के लिए: embedded Stripe dashboard के ज़रिए, या हर उस feature के लिए commerce.check() call करके जिसकी तुम्हें परवाह है। Panel में subscription history view roadmap पर है।