#bwurtz999
1 messages ยท Page 1 of 1 (latest)
Hi there. Ok so just to clarify, between which steps in this guide: https://stripe.com/docs/terminal/payments/collect-payment?terminal-sdk-platform=server-driven#verify-reader is your integration getting stuck due to poor network connectivity? Is it that it's not receiving the reader's state you aren't able to capture the PI?
I believe it's between step 2 (process the PI) and step 3 (verify the reader state)
It's a simple POS app. Items are added to the cart. When the customer is ready, the cashier hits a button that triggers the creation of the payment intent and processPaymentIntent
I then return the PI to the app. But what keeps happening is the reader accepts payment and shows the check mark but my app hasn't received the PI response yet
So it just gets stuck hanging there waiting for payment
even though it's already gone through
and if the cashier wants to clear the order and start over I have no way to check if the payment has been made because I have no PI to check
Which method do you use to verify reader state
I use webhooks as a direct means and then the payment intent itself as a back up
That process works. And with a solid internet connection I don't have any issues
Gotcha
But with poor service/delays I'm running into problems
But in your scenario with a poor internet connection, do you not receive the webhook events?
Or it's just a delay?
My server receives them fine. It's the communication back to my app that's causing the issue
yes the delay
return response()->json([
'payment_intent_id' => $paymentIntent->id,
], 200);
This is all I send back after calling processPaymentIntent
So I don't think I can make the response any smaller
In case that might be the issue
So I guess I'm wondering why the reader can communicate so much faster than my app. Are the requests significantly smaller than what I'm sending?
I guess I could create the payment intent after the first item is added and then update it after each additional item. But I'd like to try and avoid that if possible because it slows everything down
But then I guess I could at least check if the payment intent has succeeded before the cashier tries to clear the order
Is there some best practice I'm missing here?
Hm I don't think so. Let me try to pull in a colleague with more terminal experience though to see if they have any suggestions for poor network connection
Great thank you
My colleague said that for the most part you'll just need a better network connection. However, there is something you might can try:
https://stripe.com/docs/terminal/payments/collect-payment?terminal-sdk-platform=server-driven#stripe-api
They can try polling the reader status too
https://stripe.com/docs/terminal/payments/collect-payment?terminal-sdk-platform=server-driven#reader-object```
Hmm ok
But what would I be looking for when checking the terminal status?
So let's say a customer adds one item to the cart, quickly presses the 'Checkout' button, and then taps their card, all before my app can get a response back from my update-cart POST
The app is showing a screen saying 'Awaiting Payment' because it hasn't received a response yet
There is also a 'Cancel' button
When the cashier clicks that cancel button, what reader state should I be looking for to indicate that a payment was made?
Succeeded?
After a payment it just goes back to the default Stripe screen
How long does that 'succeeded' state last for?
They click the cancel button because they assume something went wrong. And the cancel button needs to be there in case someone changes their mind and wants to add more items to their order
Hello ๐
Stepping in here
That's correct. For successful payments the reader's action.status updates to succeeded
https://stripe.com/docs/terminal/payments/collect-payment?terminal-sdk-platform=server-driven#stripe-api:~:text=The action.status updates to succeeded for a successful payment.
Ok great
And will that also give me the payment intent that was successful?
So I can check that the total is correct for verification?
Yup you can check the PaymentIntent status as well as the reader's action.status to make sure the payment succeeded
But how would I know the payment intent?
The docs seem to indicate that polling the reader doesn't give me the payment intent. Just the status
Basically I'm trying to verify that before I go ahead and cancel an order, that the order actually went through
Right, you'd have to keep a track of the PaymentIntent ID from the earlier steps
https://stripe.com/docs/terminal/payments/collect-payment?terminal-sdk-platform=server-driven#process-payment
When someone clicks "checkout" on your POS, you're basically creating a payment intent server-side and processing the payment. You can share the PaymentIntent ID to your POS app and then add a button to fetch payment status which then polls the API for the PaymentIntent status
Right, this is the problem I'm facing with poor cell service:
So let's say a customer adds one item to the cart, quickly presses the 'Checkout' button, and then taps their card, all before my app can get a response back from my update-cart POST
Then I have no payment intent to check
Does that make sense?
Ah I see. Yeah that's a tricky one
Oh I guess I could create a payment intent when the order is started (empty cart)
and return that
then I'd have an ID to check?
right?
Yup, that should work
Only problem is that this slows everything down, particularly with a poor connection
But I don't see a way around it
Unless there is something I'm missing?
Yeah unfortunately until you figure out the network situation, you'll have to have some trade-offs ๐ฆ
NP! Happy to help ๐
Good luck with everything
๐