feat(licenses): update Stripe billing portal configuration and clean up logging

- Added configuration ID for the Stripe billing portal session creation to enhance functionality.
- Removed console logging of the customer ID for improved security and cleaner code.
- Commented out the configuration creation code for future reference and potential use.
This commit is contained in:
Mauricio Siu
2025-03-23 18:55:43 -06:00
parent 39e6a98179
commit 5fd8fcfa1e
2 changed files with 42 additions and 4 deletions

View File

@@ -164,10 +164,9 @@ stripeRouter.post(
try {
const { customerId } = c.req.valid("json");
console.log("Customer ID", customerId);
const session = await stripe.billingPortal.sessions.create({
customer: customerId,
configuration: process.env.STRIPE_PORTAL_CONFIGURATION_ID,
return_url: `${WEBSITE_URL}/dashboard/settings/billing`,
});
@@ -178,3 +177,44 @@ stripeRouter.post(
}
},
);
// Execute 1 time to create the configuration
// const configuration = await stripe.billingPortal.configurations.create({
// business_profile: {
// headline: "Manage your Dokploy subscription",
// },
// features: {
// subscription_update: {
// enabled: true,
// products: [
// {
// product: "prod_RxSOzNrwlfVWmv",
// prices: [
// "price_1R3XTqF3cxQuHeOzZjgaG262",
// "price_1R3XmmF3cxQuHeOzCEjz0HFz",
// ],
// },
// {
// product: "prod_RxSVDolGpUy97g",
// prices: [
// "price_1R3XanF3cxQuHeOzh7VdbbUs",
// "price_1R3Xp4F3cxQuHeOzUTNYDC9I",
// ],
// },
// {
// product: "prod_RxSaEQpbsiPFgv",
// prices: [
// "price_1R3XfOF3cxQuHeOzYFUa0eNy",
// "price_1R3XptF3cxQuHeOzZEBGMsEm",
// ],
// },
// ],
// default_allowed_updates: ["price", "quantity"],
// },
// subscription_cancel: {
// enabled: true,
// },
// payment_method_update: {
// enabled: true,
// },
// },
// });

View File

@@ -44,8 +44,6 @@ export const createLicense = async ({
user = result;
}
console.log("User", user);
const license = await tx
.insert(licenses)
.values({