When testing an application that uses Cashier, you may mock the actual HTTP requests to the Stripe API; however, this requires you to partially re-implement Cashier's own behavior. Therefore, we recommend allowing your tests to hit the actual Stripe API. While this is slower, it provides more confidence that your application is working as expected and any slow tests may be placed within their own Pest / PHPUnit testing group.
Prefer creating real Stripe test accounts and making actual API calls over mocking. This approach:
- Tests integration: Verifies your code works with the actual Stripe API
- Catches API changes: Stripe API changes will be caught by tests