src/onboard.tsTypeScript
import { createClient } from "@example/sdk"
​
const client = createClient({
apiKey: process.env.API_KEY,
region: "eu-west",
})
​
// Create a customer and start a trial
export async function onboard(email: string) {
const customer = await client.customers.create({ email })
const plan = await client.subscriptions.create({
customer: customer.id,
price: "price_pro_monthly",
trialDays: 14,
})
​
return { customer, plan }
}
​
onboard("hello@example.com").then(console.log)
TypeScript5 highlighted20 linesUTF-8

Create a free website with Framer, the website builder loved by startups, designers and agencies.