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

127
Views
How to charge with Stripe by customer id

I have flow when the user can be charged by card detail, and I`m using await stripe.createPaymentMethod for that. When payment is successful I can later get details of that user purchases with card and payment info, as well as customer id "cus__idvalue".

 const { error, paymentMethod } = await stripe.createPaymentMethod({
      type: "card",
      card: elements.getElement(CardNumberElement),
      card: elements.getElement(CardExpiryElement),
      card: elements.getElement(CardCvcElement),
    });

My question is how can I charge the same user by previously used card, without giving him the option to type his card data again. I have read Stripe docs on that case, but haven`t got a clear understanding and what methods could be helpful. Appreciate any help in advance!

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

The functionality of what you can do is limited by what stripe API provides, i doubt if the API allows one to pre enter card details based on previous transactions, except if you store card details on your site DB, which is a security flaw.

Some card processors can allow that though, so confirm from stripe if that is allowed, in which case you can then allow users store card details in their user account on your website, so it is only when a user logs in that the pre-stored card details can be used for transactions.

about 4 years ago · Juan Pablo Isaza Report

0

PaymentMethods are only reusable when attached to a customer. To retrieve all PaymentMethods for a given customer you can use the listPaymentMethods endpoint with a customer id parameter, and then use the PaymentMethod ID to create a new PaymentIntent like this:

const paymentIntent = await stripe.paymentIntents.create({
  amount: 2000,
  currency: "usd",
  payment_method: “REPLACE_WITH_PAYMENT_METHOD_ID”,
  confirm: true,
});
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!