Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

200
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda