src/onboard.tsTypeScript
1import { createClient } from "@example/sdk"
2
3const client = createClient({
4 apiKey: process.env.API_KEY,
5 region: "eu-west",
6})
7
8// Create a customer and start a trial
9export async function onboard(email: string) {
10 const customer = await client.customers.create({ email })
11 const plan = await client.subscriptions.create({
12 customer: customer.id,
13 price: "price_pro_monthly",
14 trialDays: 14,
15 })
16
17 return { customer, plan }
18}
19
20onboard("hello@example.com").then(console.log)
TypeScript5 highlighted20 linesUTF-8