#commander

1 messages · Page 1 of 1 (latest)

rapid pivot
feral cove
#

Hi @rapid pivot

rapid pivot
#

Hello! Can you give me a bit more detail? Are you working with Checkout? The payment element? something else?

feral cove
#

I´m using Payment element

#

Here my Script at the top

#

can you read it?

rapid pivot
#

Do you mean the code that you sent over already?

feral cove
#

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?

rapid pivot
#

Yeah, sorry give me a few moments - I'm not really familiar with backend beans, so I need to do some digging

feral cove
#

ok, sure

#

I guess this code needs to be sent after "startPayment()"

#

"startPayment()" is creating in the background my "BillingOrder" object (including orderNumber etc.)

rapid pivot
#

Let's back up for a minute - what specifically is your backend bean doing/what are you using it for?

feral cove
#

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?

rapid pivot
#

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?

feral cove
#

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

rapid pivot
#

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

feral cove
#

do you have a code snipped?

rapid pivot
#

No, we don't have a code snippet or example that specifically covers this

feral cove
#

can I manage to send the confirm Params to send via backend ?

rapid pivot
#

Are you asking whether you can do the confirmation server-side instead of client-side?

feral cove
#

yes

rapid pivot
feral cove
#

and how is it working for other payment methods?

rapid pivot
#

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

rapid pivot
#

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

feral cove
#

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

rapid pivot
#

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?

feral cove
rapid pivot
#

Separate auth and capture is something specific to cards and it won't work with other Payment Methods

feral cove
#

how do you mean this queueing suggestion exactly?

#

but I don´t think that will be the right approach

rapid pivot
#

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

feral cove
#

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

rapid pivot
#

No, there is no way for you to do the confirmation from your backend if you want to support more than just cards.

feral cove
#

how / when is than the Order generated and saved in the application?

#

with the Charges API it was much more easier and it was working for me