Stripe Payment Integration Issue: ‘Only registered Indian businesses can accept international payments’

  Kiến thức lập trình

I’m encountering an error while integrating Stripe payment into my React app with an Express.js backend. When attempting to process payments, I’m receiving the following error message: “As per Indian regulations, only registered Indian businesses can accept international payments.” This error is preventing the payment from being processed.

I am using “stripe”: “^16.4.0”, at back end.

Backend: Express.js

import User from '../models/UserSchema.js';
import Doctor from '../models/DoctorSchema.js';
import Booking from '../models/BookingSchema.js';
import Stripe from 'stripe';

export const getCheckoutSession = async (req, res) => {
    try {

        const doctor = await Doctor.findById(req.params.doctorId);
        const user = await User.findById(req.userId); // Corrected from res.UserId to req.userId

        if (!doctor || !user) {
            return res.status(404).json({ success: false, message: "Doctor or User not found" });
        }

        const stripe = new Stripe(process.env.STRIPE_API_KEY);
        const session = await stripe.checkout.sessions.create({
            payment_method_types: ['card'],
            mode: 'payment',
            success_url: `${process.env.CLIENT_SITE_URL}/checkout-success`,
            cancel_url: `${req.protocol}://${req.get('host')}/doctors/${doctor.id}`,
            customer_email: user.email,
            client_reference_id: req.params.doctorId,
            line_items: [
                {
                    price_data: {
                        currency: 'bdt',
                        unit_amount: doctor.ticketPrice * 100,
                        product_data: {
                            name: doctor.name,
                            description: doctor.bio,
                            images: [doctor.photo]
                        }
                    },
                    quantity: 1
                }
            ]
        });

        const booking = new Booking({
            doctor: doctor._id,
            user: user._id,
            ticketPrice: doctor.ticketPrice,
            session: session.id
        });

        await booking.save(); 

        res.status(200).json({ success: true, message: "Successfully created checkout session", session });
    } catch (error) {
        console.error(error);
        res.status(500).json({
            success: false, message: "Error creating checkout session", error: error.message
        });
    }
};

Trying to access this controller function through postman in the backend only i am getting this error

{
“success”: false,
“message”: “Error creating checkout session”,
“error”: “As per Indian regulations, only registered Indian businesses (i.e. sole proprietorships, limited liability partnerships and companies, but not individuals) can accept international payments. More info here: https://stripe.com/docs/india-exports”
}

enter image description here

Theme wordpress giá rẻ Theme wordpress giá rẻ Thiết kế website

LEAVE A COMMENT