Stripe has a doc about automated testing. It suggests that you generate the mock API responses manually for various errors and mock the responses returned.