Create Stripe Payment Method with Cloud Function (Firebase)

Integrations

I am trying to create Payment Method using Cloud Function, but I am getting an error in console.

const functions = require('firebase-functions');
const admin = require('firebase-admin');
const stripe = require("stripe")("-");

exports.createPaymentMethod = functions.https.onCall(async (data, context) => {
  try {
    const paymentMethodData = {
      type: 'card',
      card: {
        number: '4242424242424242',
        exp_month: 12,
        exp_year: 2025,
        cvc: '123',
      },
      billing_details: {
        name: 'Usuario Ejemplo',
        email: '[email protected]',
        address: {
          line1: 'Calle Ejemplo 123',
          city: 'Ciudad Ejemplo',
          postal_code: '12345',
          country: 'ES'
        }
      }
    };

    const paymentMethod = await stripe.paymentMethods.create(paymentMethodData);
    // Asegurarnos de que retornamos un string simple
    return String(paymentMethod.id);

  } catch (error) {
    console.error('Error al crear PaymentMethod:', error);
    // En caso de error, retornamos un string vacío
    return '';
  }
});
What have you tried so far?

Created a lot of API and Cloud Function to try

Did you check FlutterFlow's Documentation for this topic?
No
2