#bodger-async

1 messages · Page 1 of 1 (latest)

ancient grove
#

Hi! Sorry for the delay. Please give me a few minutes to look into this.

#

I need to accept payments asynchronously
The link you shared is for synchronous payments, so I guess you meant "synchronous"?
why the PaymentIntent can't be created on the server
Can you clarify exactly what this flow would look like?

jagged dome
#

Ah yes, sorry, I meant synchronously! Doh.

#

So at the moment, in order to create my payment intent (without sending the amount via the POST, which is obviously bad), I need to send a ton of data via the POST so that the server can work out what the amount of the payment needs to be.

#

So I was kind of hoping that instead of doing that, I could create the intent on the server (which knows how much it needs to be for) and pass the ID to the client and then the client could use it?

#

Does that even make sense?!

ancient grove
#

What you are describing sounds like the recommended way to implement Stripe (asynchronously):

  • You create the PaymentIntent on the server
  • You then pass the client_secret of the PaymentIntent to the frontend to collect the payment details
  • And you confirm the payment on the frontend
  • Then you listen to the webhook event payment_intent.succeeded to fulfil the order
jagged dome
#

It does. But I can't use that method because I can't create the thing that's being paid for until the payment has succeeded. So there's no way of knowing, when the webhook comes back, what it's for. So I assume my only option is to follow the instructions in that URL to the letter and create the payment intent via a POST, right?

ancient grove
#

Sorry for the delay.

I can't create the thing that's being paid for until the payment has succeeded
I'm not sure I follow this part. Can you clarify? I feel like this should be possible to do with the regular asynchronously implementation.
But if you really need the synchronous version, then yes you should follow the steps mentioned in the documentation.

jagged dome
#

Sorry - to explain - I'm creating a booking on our system. And I don't want to create the booking until it's been paid for.

random fiber
#

Hi there 👋 sincere apologies for the delay while I got caught up.

#

Ah, yeah bookings can be tricky because you want to be careful tying up resources before you have payment confirmation.

jagged dome
#

Hi @random fiber - thanks - so, in general, would you say it'd be better to create a booking to begin with - put it in a state that makes it clear it's not been paid for yet - then update it via the webhook once it's been paid for? Or to do it the way I'm doing it and run it all synchronously and create the booking after the payment has been confirmed?

random fiber
#

Honestly, I'm not really sure. We're not familiar with your systems and the implications that would be associated with various approaches you could build. Ultimately it's going to be up to you to decide how you want to handle that based on your business requirements and how you want to structure your flows, but we can help answer questions on how to implement Stripe to accept the payments.

jagged dome
#

OK, fair enough - thanks for your help - really appreciated!