Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

210
Vistas
How to setup payment method on creating checkout session?

I'm using stripe as an payment integration in my app. I'm creating session checkout for the customer with using mode=payment because i want to get payment from the order, but how to save payment method of the customer with this checkout session?

Here is my code:

await stripe.checkout.sessions.create({
      line_items: [
        {
          price_data: {
            unit_amount: 433,
            currency: "usd",
            product_data: {
              name: ""
            }
          },
          quantity: 1,
        }
      ],
      cancel_url: "",
      success_url: "",
      customer: customerID,
      mode: STRIPE_SESSION_MODE.PAYMENT,
      payment_method_types: ["card"],
    });

thanks to this in response i've got an url to the stripe payment form. Is there an option to save information about payment method of the customer for the future using? I know that I can use mode=setup but i want also to get payment from the price_data.

Thanks for any help!

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

You can opt to save the created payment method to a Customer object for future on-session (or off-session) payments using the setup_future_usage parameter:

await stripe.checkout.sessions.create({
  line_items: [
    {
      price_data: {
        unit_amount: 433,
        currency: "usd",
        product_data: {
          name: ""
        }
      },
      quantity: 1,
    }
  ],
  payment_intent_data: {
    setup_future_usage: "off_session"
  },
  cancel_url: "",
  success_url: "",
  customer: customerID,
  mode: STRIPE_SESSION_MODE.PAYMENT,
  payment_method_types: ["card"],
});
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda