#Sadness ;'(
1 messages · Page 1 of 1 (latest)
No problem.
there's not an easy way of handling this to be honest
but there is a beta that might help out with your scenario https://stripe.com/docs/payments/build-a-two-step-confirmation
you need to contact our support team https://support.stripe.com/?contact=true to see whether you're eligible to enter this beta
Find help and support for Stripe. Our support center provides answers on all types of situations, including account information, charges and refunds, and subscriptions information. Get your questions answered and find international support for Stripe.
Is this somehow related to this? https://stripe.com/docs/payments/run-custom-actions-before-confirmation
yes
Why is it in beta? What changes are made to the API? I can not see any.
Good to know.
Does it support LPM's? And wallets? Like Apple Pay or Google Pay
we have beta programs that aren't available for all users because we're still haven't polished all the corners of that feature
Oh i see. The Stripe limits the payment intent confirmation to only with secret key.
in this beta yes
I think that this payment flow is the best option for me. But this only runs actions before confirmation. What if user didn't authorized the payment via 3DS? Then when the payment intent will be cancelled?
the 3DS gets called before submitting the payment in the next step
which one
before this step https://stripe.com/docs/payments/run-custom-actions-before-confirmation#insert-custom-logic
Here? ```js
const form = document.getElementById('payment-form');
form.addEventListener('submit', async (event) => {
// We don't want to let default form submission happen here,
// which would refresh the page.
event.preventDefault();
const result = await stripe.updatePaymentIntent({
elements, // elements instance
params: {
payment_method_data: {
billing_details: { ... }
},
shipping: { ... }
}
});
stripePaymentMethodHandler(result);
});```
yes
So then why this step (8) is needed: ```js
const handleServerResponse = async (response) => {
if (response.error) {
// Show error from server on payment form
} else if (response.requires_action) {
// Use Stripe.js to handle the required next action
const {
error: errorAction,
paymentIntent
} = await stripe.handleNextAction({
clientSecret: response.payment_intent_client_secret
});
if (errorAction) {
// Show error from Stripe.js in payment form
} else {
// Actions handled, show success message
}
} else {
// No actions needed, show success message
}
}```
because even if the 3DS was passed in the previous step the issuing bank might (under they're own discretion) ask for another 3DS auth
OK, thanks. So then if user does not complete the second 3DS, when the payment intent is cancelled?
all the time?
yes until either they get the 3DS confirmation or you cancel them explicitly
So then how i can "unblock" the item? It will be blocked all the time.
you can actually create a time-based task to run after x amount of time and if after that time the PI didn't succeed you cancel it
and it will trigger the webhook that would "unblock" your item
Is there any way to do it better?
unfortunately with only PI you can't specify an "expiry" time
So there is not any clean solution?
only what I previously suggested, you can skip the webhook part and automatically do the logic in that time-based trigger
It seems like a bad solution, cuz it's based on time-based trigger. It has a lot of limitations for example it has a negative impact on servers CPU (in order to have it in pseudo real time i need to check the Payment Intents very frequently).
you shouldn't run the scheduler on the same machine as your server
this is normally part of a decentralized architecture or a micro-services architecture
yes it is possible to solve CPU load like that, but as I said that it is not the only reason why this solution is bad.
Like it just does not seems to be clean
Clean is a really stretchable word to be honest
anything could be clean if you code correctly and you have it follow a certain process that you put in place and you document it internally
Like by "clean" solution I mean a solution that is the simplest one and gives the most optimal result (in coding and infrastructure).
yes but you also need to be pragmatic and find the solution that works instead of criticizing it without having a backup plan
Yeah that's also true. But I always look to find the best one.
I think that i actually found one.
But it depends on one fact: Can i run custom actions before the money is tried to be transffered from user to my stripe account?
Thats the solution: If the user is on the 'requires_action' step i can (Can I?) release the item "block" because of the fact that another user can in this time buy it. But i need to again "block" it right before the action succededs to avoid buying one thing twice.
that would also require a lot of coding in an "unclean" manner as you would say
I think it's possible
Why "unclean"?
How?
because there's a lot of edge cases that you can't really control
Which ones?
If the user is on the 'requires_action' step i can (Can I?) release the item "block" because of the fact that another user can in this time buy it. But i need to again "block" it right before the action succeeds to avoid buying one thing twice.
how would you go by implementing this (in your opinion)?
from the front-end? listening to a webhook event? etc...
if you are triggering the "unblock"/"block" from the front-end what guarantees that the customer won't close their webpage and you would be stuck with a state that you don't actually want because some front-end code wasn't called
The only problem i have with this solutions is: Can i run custom actions before the money is tried to be transffered from user to my stripe account? Or: Can i run custom actions before the 'next action' procedure succedes?
I want handle it from backend.
@mossy dust I'm not sure you're going in the right direction here
A time-based scenario is the best option you have here IMO, something like a customer can hold a "product" for x amount of time. If they don't pay through this window, the "product" gets released
and the PaymentIntent gets canceled
BRB