#jenOng
1 messages · Page 1 of 1 (latest)
Hi there!
Can you share the PaymentIntent ID (pi_xxx)?
In general, if you don't want to save the payment method, just don't set setup_future_usage when creating the PaymentIntent https://stripe.com/docs/api/payment_intents/create?lang=php#create_payment_intent-setup_future_usage
Thanks! Give me a few minutes to look into this.
thank you !
Wait, you used a SetupIntent to save the card, so it's expected that it appears on the customer. SetupIntent are made for saving the card on the customer. So I'm a bit confused. https://dashboard.stripe.com/test/logs/req_hscUfkUbMPbmQM
Can you clarify what are you trying to do?
I used confirmSetup on the frontend to get the paymentMethod id and then paymentIntents.create in the backend to charge the user. I am using PaymentElement to collect credit card info for one time use and I want to charge that credit card without it being saved
This doesn't really make sense. You basically have two options:
- If you want to save the customer's payment method, then use a SetupIntent
- If you don't want to save the customer's payment method, then don't use a SetupIntent and directly create a PaymentIntent
oh okay, how can I collect the paymentMethod id in the frontend to pass to create paymentIntent? I have something like this but it errors out at PaymentElement:
const cardElement = elements.getElement(PaymentElement);
const paymentMethod = await stripe.createPaymentMethod({
type: 'card',
card: cardElement,
});
Why are you calling createPaymentMethod? I recommend just following this doc to create PaymentIntent and confirm it: https://stripe.com/docs/payments/accept-a-payment?platform=web&ui=elements
Or, if you want to first collect the payment method and later create the PaymentIntent, you can check our new flow described here: https://stripe.com/docs/payments/accept-a-payment-deferred
thanks, I'll look into that