#donb-test-charges
1 messages · Page 1 of 1 (latest)
Hey there! I just double checked our test cards, but it looks like we don't have one that fits this exact scenario.
So what you'd likely want to do is:
- Charge your test customer and have them pay with a valid test card (such as our one ending in 4242)
- Update this test user's payment method to one that will fail due to insufficient funds (like our test card ending in 9995)
- Charge the customer again and the payment should fail due to
insufficient_funds
Our complete list of test cards can be found here:
https://stripe.com/docs/testing
The problem is both charges happen in the same function call (one is actually a hold). So there's really no time for me to switch cards between charges.
Oh, that sounds a bit trickier, give me a second to think about that.
Ok, thanks!
Another thing I was just thinking about. Maybe I'm going about this the wrong way doing the charge first and then the hold. The problem I'm having is the charge succeeds, but then the hold fails so we need to refund the charge. So I'm trying to test for that case to make sure we refund properly when this happens.
Maybe instead we should do the hold first and then the charge because if the charge fails then the hold will automatically resolve in a week without us needing to do anything?
Hm, let's take a step back for a moment. Could you help us understand your use-case, and why you would be doing both a charge and a hold?
Yeah good question. The use case is a customer adding items to their subscription. The important part here is we provide physical goods. We made a business decision that we don't want to add those extra items to their subscription charges until the items are actually delivered and they are using them, but we want to make sure they can pay for them once their added which is why we place a hold for those new items.
The charge is because we charge customers service fees like "delivery & assembly" which we charge at checkout.