fix: portal return url
This commit is contained in:
@@ -43,6 +43,7 @@ export const createBillingPortalSession = async ({
|
||||
}
|
||||
|
||||
// 1. Try to create billing portal session
|
||||
|
||||
try {
|
||||
return await stripeCli.billingPortal.sessions.create({
|
||||
customer: stripeCustomerId,
|
||||
|
||||
@@ -19,7 +19,8 @@ export const handleCreateBillingPortal = createRoute({
|
||||
const { db, org, env } = ctx;
|
||||
const { return_url: returnUrl } = c.req.valid("query");
|
||||
const { customer_id: customerId } = c.req.param();
|
||||
const { configuration_id: configurationId } = c.req.valid("json") ?? {};
|
||||
const { configuration_id: configurationId, return_url: returnUrl2 } =
|
||||
c.req.valid("json") ?? {};
|
||||
|
||||
const customer = await CusService.get({
|
||||
db,
|
||||
@@ -35,7 +36,7 @@ export const handleCreateBillingPortal = createRoute({
|
||||
const session = await createBillingPortalSession({
|
||||
ctx,
|
||||
customer,
|
||||
returnUrl,
|
||||
returnUrl: returnUrl2 || returnUrl,
|
||||
configurationId,
|
||||
});
|
||||
|
||||
|
||||
@@ -159,6 +159,10 @@ export const GetBillingPortalBodySchema = z
|
||||
description:
|
||||
"Stripe billing portal configuration ID. Create configurations in your Stripe dashboard.",
|
||||
}),
|
||||
return_url: z.string().optional().meta({
|
||||
description:
|
||||
"URL to redirect to when back button is clicked in the billing portal",
|
||||
}),
|
||||
})
|
||||
.optional();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user