콘텐츠로 이동

고객

Dashboard > Commerce > Customers 탭 또는 SDK를 통해 앱의 청구 대상 사용자를 관리하세요.

**고객(customer)**은 앱에서 요금이 청구되는 주체로, 일반적으로 사용자, 조직, 또는 프로젝트입니다. 해당 주체가 여러분의 데이터베이스에 생성되는 즉시 Proyecta에 고객을 생성하고, 이후 참조할 수 있도록 반환된 id를 저장해두세요.

Dashboard > Commerce를 열고 Customers 탭으로 이동하면 현재 앱의 모든 청구 대상 고객을 확인할 수 있습니다. 각 행에는 다음 정보가 표시됩니다:

  • 이메일
  • 전체 이름
  • 생성 일시

검색 상자와 이메일 또는 생성 날짜별 필터링은 SDK를 통해 사용할 수 있으며, 패널의 더 풍부한 컨트롤은 추후 제공될 예정입니다.

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 customer
const customer = await proyecta.commerce.customers.get({ customerId: 'cus_123' });
// Paginate
const result = await proyecta.commerce.customers.list({ limit: '20' });
for (const customer of result.data) {
console.log(customer.name, customer.email);
}
await proyecta.commerce.customers.update({ customerId: 'cus_123', email: 'new@example.com', address: { ... } });

사용자 회원가입 시 Proyecta 고객 생성하기

When a new user finishes signup, call proyecta.commerce.customers.create
with their email and name. Store the returned id on the user record as
proyecta_customer_id.

관리자용 고객 브라우저 구축하기

Build an admin page at /admin/customers that lists every Proyecta customer
with their email, name, created date, and a link to view their detail page.
Use proyecta.commerce.customers.list to paginate through all customers.

모든 사용자에게 Proyecta 고객을 생성해야 하나요, 아니면 유료 사용자에게만 생성해야 하나요?

모든 사용자에게 생성하세요. 무료이며, 멱등성(idempotent)이 보장되고(동일한 이메일로 호출하면 동일한 고객이 반환됨), 사용자가 업그레이드하는 순간 즉시 대응할 수 있어 나중에 데이터를 일괄 채워 넣는 번거로움이 없습니다.

고객이 여러 개의 구독을 가질 수 있나요?

네. 구독은 고객에 속하며, 그 반대가 아닙니다. 새 구독 checkout 세션을 생성하려면 commerce.checkout()을 사용하세요.

고객이 어떤 구독에 가입되어 있는지 확인하려면 어떻게 하나요?

현재는 내장된 Stripe 대시보드를 통하거나, 원하는 각 기능에 대해 commerce.check()를 호출하는 방식으로 확인할 수 있습니다. 패널 내 구독 내역 보기 기능은 로드맵에 포함되어 있습니다.