feat: implement Stripe checkout integration and add related API endpoints

This commit is contained in:
Frank John Begornia
2025-11-08 01:47:14 +08:00
parent 86f9cf803a
commit 0ff41822af
12 changed files with 443 additions and 97 deletions

View File

@@ -0,0 +1,36 @@
export default defineEventHandler(async (event) => {
const body = await readBody<{
stripeSessionId: string
designId: string
templateId?: string
amount: number
currency: string
customerEmail?: string
assets?: {
previewUrl?: string
productionUrl?: string
}
}>(event)
if (!body?.stripeSessionId || !body?.designId) {
throw createError({ statusCode: 400, statusMessage: 'Missing required fields' })
}
// TODO: Persist the transaction to your database of choice.
// Example shape:
// await db.transaction.create({
// stripeSessionId: body.stripeSessionId,
// designId: body.designId,
// templateId: body.templateId,
// amount: body.amount,
// currency: body.currency,
// customerEmail: body.customerEmail,
// previewUrl: body.assets?.previewUrl,
// productionUrl: body.assets?.productionUrl,
// })
return {
ok: true,
receivedAt: new Date().toISOString(),
}
})