I am trying to avoid double charging my customers, even under the most unlikely chain of events. I have this scenario in my mind, and I can't find a proper solution due to what I think is an hole in Stripe API. Scenario is:
- cutomer has a card, charge succeeds but a network error happens. An idempotency key has been used and saved in the db.
- customer change card
- system retry the failed charge, using the same idempotency key. Charge fails because parameters are not the same as before (card is different!).
Under this circumstance, we lack the api to proceed. If I reset the idempotency key and retry again, I am going to charge twice. Notice I do not have a chargeId, neither I could have one because network failed.
IMHO we need an api to retrieve the charge by idempotency key, or query by metadata.
Any thoughts?