Skip to content

Commit

Permalink
Merge pull request #2 from jschutt/master
Browse files Browse the repository at this point in the history
Updated README with Laravel notes
  • Loading branch information
nticaric committed Jul 9, 2015
2 parents 08b3dd7 + 6f0bc48 commit bc0f089
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,23 @@ For your convenience you can use chained methods
$tester = new TeamTNT\Stripe\WebhookTester('http://local.dev/stripe/webhooks);
$response = $tester->setVersion('2014-09-08')->triggerEvent('charge.succeeded');
```
## Laravel Integration
To implement this package with [Laravel Cashier](http://laravel.com/docs/5.1/billing), you will need to override the `eventExistsOnStripe()` method in `Laravel\Cashier\WebhookController` with something like this:

``` php
protected function eventExistsOnStripe($id)
{
if(App::environment() == 'testing' or App::environment() == 'local') {
return true;
}
try {
return ! is_null(StripeEvent::retrieve($id, Config::get('services.stripe.secret')));
} catch (Exception $e) {
return false;
}
}
```
Without the environment checks Cashier attempts to verify that the dummy event is a valid webhook with Stripe, which will obviously fail.

## Available versions and events

Expand Down

0 comments on commit bc0f089

Please sign in to comment.