#xyd.xyz

1 messages · Page 1 of 1 (latest)

astral dockBOT
#

Hello! We'll be with you shortly. 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.

torn basin
#

Hey there

#

If you'll summarize your issue here then I'd be happy to help

short geyser
#

let me try

#

so we have used stripe sdk to auto trigger payment (visa and mastercard ) in our app when the app detect that user's balance (in the in-app wallet) is not enough to pay their purchase. (we offer parking service btw).

recently we introduced another custom built crypto payment option for users to pay with crypto (that has nothing to do with Stripe). So the logic is the app will try to pay with their crypto wallet first, if fails, it will fall back to use the Stripe bank debit, which will trigger the function in Stripe. Everything works well untile recently, there is one user used our parking service, then the app tries to pay with his crypto wallet, but failed due to insufficient balance, then it fall back to the bank debit. but the issue is this user doesn't have money either on his bank account. We have a logic to block the user once bank payment fails due to whatever reason (dispute, insufficient fund etc.) However, in this scenario, we are failed to block the user (there are some bugs in our code)

The question I want to ask Stripe is, you only have one declined payment test card we can use in the test env, which doesn't trigger this error. So we cannot reproduce it. Unless we use it in the production env with real bank card. This is very annoying, cuz developer cannot fix bug in the prod env.

#

this is the test car 4000000000000341 we can use, it's generic decline

#

the error message happened for this and we tried to reproduce in prod is "insufficient fund"

torn basin
#

The failure within Stripe is a card decline or an ACH debit failure?

short geyser
#

I hope you got the point: we are not able to reproduce the error in test env, because stripe test card is not behave the same as they do in prod env

torn basin
#

Okay well first, you can always mock the response in your test environment -- you don't actually have to hit the API at all.

#

Second, are you looking for testing insufficient_funds using a card or an ACH debit payment?

short geyser
#

yes, preferrably the insufficient_fund error response from Stripe

torn basin
#

And 4000000000009995 will indeed trigger insuffient funds

short geyser
#

that card won't work

torn basin
#

Now I assume your issue is Customer attachment

short geyser
#

if you check it carefully, only 4000000000000341 can be linked to a customer id

torn basin
#

But all you need to do is to see the response, as I noted above, so you could just create a one-off charge to see that.

#

Then you can mock the response

#

In your actual tests

short geyser
#

we can indeed mock it up, but that will take a lot of effort, cuz we are not writing test cases, we are doing debugging. We have no idea where the bug is. the best approach is to reproduce what exactly happen in prod env, if we try to mock this and that, it will take us a lot of time, and may skip the chance to find the bug

torn basin
#

Yeah that doesn't really make a lot of sense... it should be quite obvious from your code and your tests where you would receive an insufficient_funds decline -- like that will only happen when confirming a PaymentIntent or SetupIntent. So that is really the only spot you need to mock.

#

We don't have a test card for every situation in prod

#

It just isn't how it works

#

Nor the intention

short geyser
#

I know that, just making the feedback. why not allowing 4000000000009995 to be linked to a customer id. that will make dev's life much easier

torn basin
#

Yeah that's fair feedback

#

I'm happy to submit a feature request

short geyser
#

you have so many test card there, add a few more doesn't kill the system i believe