Enable multilingual support
Hi @leerob I'd love to take on enabling multilingual support if itβs still available.
import Stripe from 'stripe';
const stripe = new Stripe(process.env.STRIPE_SECRET_KEY);
export default async function handler(req, res) { if (req.method === 'POST') { const { action, customerId, returnUrl } = req.body;
try {
if (action === 'configure') {
// Configure the Billing Portal
const configuration = await stripe.billingPortal.configurations.create({
business_profile: {
name: 'Your Business Name', // Replace with your business name
privacy_policy_url: 'https://example.com/privacy',
terms_of_service_url: 'https://example.com/terms',
},
features: {
subscription_update: {
enabled: true,
default_allowed_updates: ['plan', 'quantity'], // Adjust as needed
},
payment_method_update: {
enabled: true,
},
},
});
return res.status(200).json({ message: 'Configuration created', configuration });
} else if (action === 'create-session') {
// Create a Billing Portal Session
if (!customerId || !returnUrl) {
return res.status(400).json({ error: 'Missing customerId or returnUrl' });
}
const session = await stripe.billingPortal.sessions.create({
customer: customerId,
return_url: returnUrl,
});
return res.status(200).json({ url: session.url });
} else {
return res.status(400).json({ error: 'Invalid action' });
}
} catch (error) {
console.error('Stripe API Error:', error);
return res.status(500).json({ error: error.message });
}
} else { return res.status(405).json({ error: 'Method not allowed' }); } }
π Welcome to my open-source project: https://github.com/liuhuapiaoyuan/nextjs-prisma-stripe-saas-starter
π We are now supporting i18n!
- π Simplify your authentication architecture with Auth.js.
- π Easily implement internationalization using
next-intl. - π οΈ Make database operations more convenient with
prismaORM tool.
Let's build something amazing together! πβ¨
Hey there, we don't plan to add this to the base template, but seems like there's already some good forks exploring this!