Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

199
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!