#jaybabu_best-practices

1 messages ยท Page 1 of 1 (latest)

rare oasisBOT
#

๐Ÿ‘‹ Welcome to your new thread!

โฒ๏ธ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.

โฑ๏ธ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.

๐Ÿ”— This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1296842200709206031

๐Ÿ“ Have more to share? Add more details, code, screenshots, videos, etc. below.

Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.

jovial wave
#

Hey there, can you share some snippets of your code for your steps 2 & 3 so i can undersstand a bit more about your integration?

#

Also, and example payment intent ID that completed successfully following the pattern you describe would be helpful

sage lotus
jovial wave
#

.setPaymentMethod(!isCardPresent ? cardId.get() : null)
Where is this card coming from at intent creation time? I don't understand the flow here

#

oh, wait, that looks to be for the not card present case

sage lotus
#

this is how we determine card present or not. correct

jovial wave
#

for card present you attach nothing, that makes more sense

sage lotus
#

95-99% is card present

jovial wave
#

ok

#
  1. Attach card present payment method
    So, here, you don't mean you attach a specific payment method ID, you mean you set the payment method type to card_present to get it ready for collection via terminal reader
sage lotus
#

sorry, yes. the payment method gets attached by the terminal

jovial wave
#

ok, thanks for elaborating, i think I understand better now.

#

When you process a payment, Stripe immediately responds to the request with an HTTP 200 status code and returns a reader with an action status of in_progress.

#

To verify the reader state, listen to the terminal.reader.action_succeeded webhook or poll the Reader and PaymentIntent status to receive the status of the payment.

#

So you're doing the polling approach. If you want to stop that, you can listen for the webhook for the completed action.

sage lotus
#

We are more wondering how you can poll the payment intent?

jovial wave
#

Sure, you can do that, like it says

#

There is generally no such processing or in progress status for the payment intent for cards

sage lotus
#

I only see a way of doing it for success

jovial wave
#

What do you mean?

#

You can poll the payment intent to check the status is succeeded

#

Do you have an example payment intent with failures?

sage lotus
#

Payment Intent stays in requires_payment_method. There is no indictation that payment failed

jovial wave
#

Can you share an example pi_123 ID?

sage lotus
#

yes, one second

jovial wave
#

That's the expected state after payment failure, because it still requires a payment method

#

You can reuse the same PI again, for example, asking the customer to try again, or try another card

sage lotus
#

pi_3QBHIWDCuRuHsY0o10GAmDsY

#

Yes, I get that. I am saying you have to rely on the terminal state to do that

#

You can't just use the payment intent

#

Currently, we call cancel payment intent after every failure

jovial wave
#

You can, either by listening to the payment_intent.payment_failed events (eg: https://dashboard.stripe.com/events/evt_3QBHIWDCuRuHsY0o1bGf9QB5) or by inspecting the last_payment_error attribute:
https://docs.stripe.com/api/payment_intents/object#payment_intent_object-last_payment_error

jovial wave
sage lotus
#

We do that to ensure no payment error happens on it or if the terminal became unavailable we need to know if the payment went through or not

#

Okay, this last_payment_error might be enough. Thank you

#

The cancel call addition has been driven by issues with the terminal apis and the device not being available