#MarcusStripe
1 messages ยท Page 1 of 1 (latest)
Hi there ๐ based on what you're describing, it sounds like you're trying to process a payment for a Customer where you already have a Payment Method created. Am I reading that correctly?
When using confirmCardPayment you can use the payment_method parameter to pass the ID of an existing Payment Method that you want to use for the payment:
https://stripe.com/docs/js/payment_intents/confirm_card_payment#stripe_confirm_card_payment-data-payment_method
and how would that be confirmed with 3d secure?
3DS is prompted for if necessary, and that is handled by stripe.js as part of the confirmation step.
yeah but then the client needs the client secret, right?
so I'd need to provide the client secret form the backend in advance
Yes, the clientSecret is necessary information in order to use stripe.js.
and what you describe.. only works with the payment id.. or is there another way also?
wouldn the payment intent client secret alone do the trick since it shoudl tell the default card also>
?
I don't think so, but I might be mistaken. What happens if you call confirmCardPayment with just a clientSecret?
we are on it ๐
the payment id we actually dont store on our end.
so I would in that case have to ADDITIONALLY have to retrieve the customer
to get the id of the payment method
If you're trying to confirm for an existing customer attached payment method to support authentication, you can provide that payment method ID during confirmation
what?
didnt (fully) understand
so in the backend, I prepare the one time payment, with an invoice, finalize the invoice, on the finalize call I add an expand for the payment intent client secret
now if I need the payment method id additionally, it seems I need another call
for the default card of the customer
How does an invoice come into play here? You're creating manual invoices?
If you say you already have the PM saved & attached to the customer, you can confirm the payment using that PM by id:
https://stripe.com/docs/js/payment_intents/confirm_card_payment#stripe_confirm_card_payment-data-payment_method
stripe.confirmCardPayment(client_secret, { payment_method: 'pm_123' })
Not sure what you mean by this. Assuming you set the customer invoice_settings[default_payment_method] and the invoice is using charge_automatically and you haven't disabled auto-advance, that PM should be used to pay this.
The way to achieve what, exactly?
You do not need to use an invoice
You can but you can collect one time payments using just Payment Intents directly. Invoices use payment intents internally, but are not a required pattern.
Maybe you have some business requirements that lead you to use invoices?
But if I need to give the id of the payment metod in the client call - confirmPayment - then how does the client get this id? I need to return it from the backend - and how does the backend get the payment Id? We do not store it. so either there is a possibility of another expand on the invoice creation or finanlization.. or I need to make a call for the default payment method id additionally
This is the guide that walks through a one time payment flow with a payment intent: https://stripe.com/docs/payments/accept-a-payment?platform=web&ui=elements
For a one-time payment, you'd typically collect the payment details during confirmation in the client (eg using Elements)
Maybe you have some business requirements that lead you to use invoices?
I was told to do so by your colleagues here. You are one of the most experienced stripe guys here so I trust what you are saying ๐
To use a previously collected card, you'd need to supply those PM ids
well technically... at some point... for anything paid.. of course the customer needs an invoice.. but how this is achived.. by frontend or backend or whatever.. I do not really care
That's why I'm wondering if you mentioned some requirements in the past that lead to the invoice suggestion
no
the customer needs an invoice
do you mean receipt?
they wanted me to attach the payment to the subscription that also exists
but I do not want that
An invoice is a specific legal document, and perhaps this is why you were told manual invoices
I want it to be bought / paid independent of the fact of a subscription.. which might even when requirtement change in the future.. not at all exist
well again.. we need to send an invoice at some point for the one time payment
in the USA, things mighht be more relaxed. but in Germany, for any money movement... we need to send an invoice to the customer
Ok, fair -- that's the requirement I was wondering about, you do need an invoice for regulatory reasons
OK, so you're using manual invoices ๐
And you've collected and saved card details
but the payment failed as requiring authentication
So, yes, you need to get the customer on session, and yes you need the invoice payment intent client_secret
Then you can optionally send the payment method id to the client and use that during confirmation, if you wish to retry with the same card
Or, you can have the customer provide new payment details
well the customer is on session at this point anyway
but I would like to just use their default card and not force them to re-enter their card
OK then you can provide that automatically as i described
And just show the customer a "confirm payment" button or similar to trigger the flow
so again.. how... is there the possibility of an expand on the finanlize invoice call?
or do I need to make an extra call to get the customer's payment method id?
Do you have a specific finalize request I can look at where you're seeing this?