🚸 (billing) Set existing stripe customer for custom plan checkout
This commit is contained in:
@@ -65,12 +65,14 @@ export const createCustomCheckoutSession = authenticatedProcedure
|
|||||||
} as Stripe.CustomerCreateParams.TaxIdDatum)
|
} as Stripe.CustomerCreateParams.TaxIdDatum)
|
||||||
: undefined
|
: undefined
|
||||||
|
|
||||||
const customer = await stripe.customers.create({
|
const customer = workspace.stripeId
|
||||||
email,
|
? await stripe.customers.retrieve(workspace.stripeId)
|
||||||
name: workspace.claimableCustomPlan.companyName ?? workspace.name,
|
: await stripe.customers.create({
|
||||||
metadata: { workspaceId },
|
email,
|
||||||
tax_id_data: vat ? [vat] : undefined,
|
name: workspace.claimableCustomPlan.companyName ?? workspace.name,
|
||||||
})
|
metadata: { workspaceId },
|
||||||
|
tax_id_data: vat ? [vat] : undefined,
|
||||||
|
})
|
||||||
|
|
||||||
const session = await stripe.checkout.sessions.create({
|
const session = await stripe.checkout.sessions.create({
|
||||||
success_url: `${returnUrl}?stripe=${Plan.CUSTOM}&success=true`,
|
success_url: `${returnUrl}?stripe=${Plan.CUSTOM}&success=true`,
|
||||||
|
|||||||
Reference in New Issue
Block a user