This is what you want to do, great post: https://bryceandy.com/posts/quick-php-tests-for-stripe-integrations-with-phpunit Basically, you will mock the class that makes the api requests to Stripe.