Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable multilingual support #71

Open
mhmdAljefri opened this issue Nov 4, 2024 · 3 comments
Open

Enable multilingual support #71

mhmdAljefri opened this issue Nov 4, 2024 · 3 comments

Comments

@mhmdAljefri
Copy link

No description provided.

@yousri-mahmoud
Copy link

Hi @leerob I'd love to take on enabling multilingual support if it’s still available.

@sanjomathew09
Copy link

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' });
}
}

@liuhuapiaoyuan
Copy link

🎉 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 prisma ORM tool.

Let's build something amazing together! 🚀✨

Image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants