#roy_code

1 messages ยท Page 1 of 1 (latest)

wise sageBOT
#

๐Ÿ‘‹ 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/1506126120007897221

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

tropic hull
#

could you help how i can handle/store the test failure card set_intent

restive ravine
tropic hull
#

unable to setup the intent for the error card

restive ravine
#

Just to make sure I point you in the right direction, could you clarify what you mean by "unable to set up the intent for the error card"? What error are you running into, and are you following a specific guide or doc? That'll help me better understand where things are going wrong.

tropic hull
#

Iโ€™m trying to create a Setup Intent using a Stripe failure test card, but Stripe throws an error saying the card is invalid. My goal is to set up the intent with the failure card, attempt the charge, and test the corresponding error code returned by Stripe and proceed with our retry logic

restive ravine
#

is there a reason why you don't just try with a PaymentIntent? and have to use a SetupIntent first?

tropic hull
#

i have to setup intent first

#

We have our logic that will pick the record and attempt the charge

restive ravine
#

hmmm, gimme a while to see what's possible

tropic hull
#

thanks

restive ravine
#

sorry, there's no way to use that card with a SetupIntent first.

Would attaching the card to a Customer (without a SetupIntent) work? Doing it this way would just be for testing purposes

tropic hull
#

is it possible to add the payment method for error card?

#

without setup intent we can't charge the amount in future right?

restive ravine
#

There's actually no need to use a SetupIntent before a PaymentIntent if your goal is to charge the customer immediately, and save the payment method for future use.

If you want to save the card and charge the customer right away, you can do both in a single step using a PaymentIntent with the setup_future_usage="off_session" parameter. This saves the payment method for future use while also completing the charge in one go. More details here: https://docs.stripe.com/payments/save-and-reuse

Can you share a bit more on how your payment process works - are you saving the card and charging it at a later point in time? Or are you charging the customer immediately after collecting their card details?

tropic hull
#

charging the customer immediately and saving the paymentmethod for future auto charge

restive ravine
tropic hull
#

still how come we will get the paymentmethod for the error card? that is confusing me

restive ravine
#

what do you mean by you will get the payment method for the error card?

tropic hull
#

paymentmethod id

restive ravine
#

could you share a bit more detail? Specifically, what behavior are you expecting to see, and what's actually happening instead? I'm having trouble understanding why getting the PaymentMethod ID is an issue

tropic hull
#

let me rephrase my statement

tropic hull
#

one quick question :For idempotency-key param, should we always pass a different key for each request?

restive ravine
wise sageBOT
barren glen
#

hello ๐Ÿ‘‹ I'm taking over the thread, let me know if you have further questions ๐Ÿ™‚

tropic hull
#

pls wait for a while checking few items

#

while adding the error card in set_up intent getting the above error.

barren glen
#

could you share with me the request ID please? It should be prefixed with req_

tropic hull
#

req_M7RTmXVaPJ6q1g

barren glen
#

req_M7RTmXVaPJ6q1g returned the decline code card_velocity_exceeded . I see that you're using a test card ending with 6975, which is the test card to use to simulate payment scenarios where card Exceeding velocity limit decline. In this case, the 402 error is expected, this card cannot be set up for future charges using SetupIntents.

tropic hull
#

that is what my question was, we can't use the error card in the setup for future charging?

barren glen
#

Yes, you can't. The purpose of SetupIntent is to let merchants set up cards for successful future charges. When the SetupIntent is being confirm, Stripe does validate the card to check if it can be used in the future. It wouldn't help merchants if we allow cards that cannot be charged to be saved, because there would result in a decline in the future.

tropic hull
#

Now, is there any other alternate way to test this scenario? We are trying to implement the auto-retry logic for future payment failures. mainly for the (processing_error and card_velocity_exceeded) erro code

barren glen
#

Is my understanding correct that you'd like to retry charging the same card even if it return card_velocity_exceeded error?

tropic hull
#

yes

#

That won't be possible ?

barren glen
#

It is possible, this is the guide to follow if you want to handle decline's programmatically: https://docs.stripe.com/declines/card#retrying-issuer-declines
The handling for SetupIntentSimilar is similar to PaymentIntent, you'd want to look up the last_setup_error.advice_code on the SetupIntent and retry the SetupIntent if the advice code is try_again_later.

#

However, since the customer will be on-session during the SetupIntent, I would recommend asking the customer to input a new payment method instead of charging the same card that was already declined

tropic hull
#

I would recommend asking the customer to input a new payment method instead of charging the same card that was already declined.

this is what we are trying. before informing to the customer we just want to do one retry and then sending email to customer. Lets think this card might added previously, now we are getting the error means