A customer's card is declined at checkout. They try again, maybe with the same card after approving a bank notification, maybe from their phone instead of their laptop. Instead of going through, the payment fails again with a confusing error. Some give up; others email support.
On a WooCommerce membership platform I support (FunnelKit checkout + Stripe), this was happening regularly. The cause turned out to be a single piece of data: the customer's browser user-agent string.
A quick primer on Stripe idempotency keys
When a payment plugin sends a request to Stripe, it can include an idempotency key : a unique label for that operation. If the same request is sent twice (say, after a network hiccup), Stripe recognises the key and returns the original result instead of charging the customer twice.
There's one strict rule: a key can only be reused with exactly the same parameters.…