#commander
1 messages · Page 1 of 1 (latest)
Hi @rapid pivot
Hello! Can you give me a bit more detail? Are you working with Checkout? The payment element? something else?
Do you mean the code that you sent over already?
yes
the second one
my issue is, that my backend bean is executed... but during the same time Stripe send me also the webhook
but for my process I need to complete before all steps from the backend bean
@rapid pivot are you still there?
Yeah, sorry give me a few moments - I'm not really familiar with backend beans, so I need to do some digging
ok, sure
I guess this code needs to be sent after "startPayment()"
"startPayment()" is creating in the background my "BillingOrder" object (including orderNumber etc.)
Let's back up for a minute - what specifically is your backend bean doing/what are you using it for?
I have this checkout page
PaymentIntent object is created and the client secret is then available on client side... also the Stripe Element is showing up (please see section "Ihre Zahlungsdaten")
Now I press "Zahlungspflichtig bestellen" and I will call a backend bean..... this is creating the Billing Order in the backgroud (including orderNumber etc.)... Also my application saves a PaymentTransaction and I store the PaymentIntent ID into that to have a match between my PaymentTransaction from my application to the PaymentIntent from Stripe
the problem is now, that Stripe sends me in the same process also a redirect to my confirmation page (https://my-site.com/order/123/complete).... and send also the webhook.... but my backend bean is not 100% completed...
do you understand the issue?
Yeah I think I understand what you're saying - basically you have some kind of fulfillment process that is being started by your backend bean, and you have logic in your webhook handler that needs the backend bean to be complete before the webhook event comes in, right?
right
Also:
I cannot save the BillingOrder object before, because it make no sense to store the BillingOrder, before the customer has not started the payment.
And I cannot save it after I got the webhook from Stripe, because than I loose my BillingOrder - object
I don't know enough about backend beans to know if there's a way to guarantee that it finished before the redirect/webhook event is sent, but you could implement some kind of queueing system to immediately respond with 200 for the webhook event but wait to process them until your backend bean is done
do you have a code snipped?
No, we don't have a code snippet or example that specifically covers this
can I manage to send the confirm Params to send via backend ?
Are you asking whether you can do the confirmation server-side instead of client-side?
yes
Yes, this is something you can do (https://stripe.com/docs/payments/accept-a-payment-synchronously) but it's only supported for cards, and it won't work with Payment Element
and how is it working for other payment methods?
It wouldn't - this would be something you can only do for card payment methods. If you need to support other payment methods you can't do this
I don't know specifically what they're doing, but right off the bat they aren't using the Payment Element. I would guess that they are creating the Payment Method first, and then using it in a Payment Intent
yes, but I´m doing this also
the process flow is still unclear for me... When do I create a BillingOrder in my app? In my opinion at the same page as I can see the payment methods / credit card etc... Or can I save in the PaymentIntent object also my BillingOrder object? If this is possible I can wait for the succeeded webhook and get this object
If your goal here is to exactly emulate what that specific site it doing I would recommend against it - they are using older/deprecated functions. Is there a reason why the queueing suggestion I gave earlier doesn't work for you?
or is the Checkout the right approach instead Payment Intent ? https://stripe.com/docs/payments/accept-a-payment#auth-and-capture
Separate auth and capture is something specific to cards and it won't work with other Payment Methods
how do you mean this queueing suggestion exactly?
but I don´t think that will be the right approach
When the webhook event comes in you'd add it to a queue that you pull off of so that you don't process the payment success until AFTER your backend bean is done - it's just delaying whatever processing you do based on the webhook event until you know that you've completed all the prerequisite steps
is there no option to send the payment request from my backend bean instead from the client?
this code from client should be replaced to backend
No, there is no way for you to do the confirmation from your backend if you want to support more than just cards.