#theswerd-paymentelement-pm
1 messages · Page 1 of 1 (latest)
hello! that is not supported, I know the team has heard that feedback but no timeline on if/when that would be supported
can payment elements support the charges api with a token?
it does not! only supports PaymentIntents and PaymentMethods
I think you're trying to do server-side payments right?
what is the use-case
yep
its a little bit of a long one
I'm doing event ticketing
I've designed a system that works using the charges api that:
- gets the user information + the amount of tickets they want
- puts a hold on that money in their account
- sets them as the owner of the tickets
- transfers the money to a connect account
4b. If the transfer fails then they lose ownership of the tickets
For this to work I need to be able to not confirm the payout immediately, I need to set the payment Intent amount on my backend after they checkout, and I need to be able to work on my backend so I can manage ticket ownership
I've taken care of the first two of these by using a setup intent to start
but now I need to get a token i can use for a payment intent on my backend to finish the process
but now I need to get a token i can use for a payment intent on my backend to finish the process
you're using a SetupIntent with a PaymentMethod, so that PaymentMethod is what you want to use to confirm a PaymentIntent server-side
the "token" is the PaymentMethod
would stripe?.createPaymentMethod(elements) work?
where elements is bound to the PaymentElement
?
but why do createPaymentMethod()
like don't you already have a PaymentMethod because of
I've taken care of the first two of these by using a setup intent to start
like your SetupIntent is collecting a PaymentMethod, no?
so i can just send the client secret back to my backend?
I think im starting to get this better
would I use confirmSetup?
let's take a step back
can you detail to me, exactly what you've implemented here:
I've taken care of the first two of these by using a setup intent to start
what are you doing with a SetupIntent?
I think I'm actually really getting it now
Can setupIntent redirects have form payloads?
Hmm, this is not supported.
how do i handle if a client secret has already been used, but then a user goes back?
If the Setup is not used, then the client secret is not used. They can go back and use that client serret as it has not been consumed.
to get the redirect I have to use stripe.confirmSetup
and once i do that, when a user goes back to the page, the page doesn't work anymore because it says the setup intent has already been used
In this case, you won't be able to use the client secret as this is already consumed and you'd have a payment method.
What are you trying to achieve here?
currently dealing with stripe.confirmSetup({}), which redirects them to a page that takes in the data and completes the purchase
which works
however, if a user then presses the back button, and tries to buy more tickets, then it doesn't work
In this case, if you expect a purchase, you'd want to use the Payment Intents: https://stripe.com/docs/payments/payment-intents and https://stripe.com/docs/api/payment_intents
i explained earlier in this conversation why i can't use a payment intent
i don't know the price ahead of time
So what's blocking you with SetupIntents?
that if a user:
- enters their card
- clicks purchase
- we do stripe.confirmSetup with redirectMode always
- they get redirected, but then press the back button
- they enter their card again,
When they press the back button they just reload the page right? So you should know who they are and that they did a SetupIntent already and you would redirect them back to another page
then 5 won't work because it throws a "setup_intent_unexpected_state"
it doesn't always reload
browsers cache back by default
Gotcha, so in that case you catch the error and you can handle this accordingly by showing them that they are already confirmed.
alright
thank you
wait
can I reuse the same secret twice?
if they choose to purchase tickets for a second time
No, the secret is associated to that SetupIntent and it's completed at that point.
But you also don't need another SetupIntent if you already have their card details
so i can reuse the payment method on the setup intent?
what do you mean "reuse the payment method on the setup intent"