https://github.com/conedevelopment/bazar-stripe
The Stripe Payment gateway for Bazar.
https://github.com/conedevelopment/bazar-stripe
Last synced: 8 months ago
JSON representation
The Stripe Payment gateway for Bazar.
- Host: GitHub
- URL: https://github.com/conedevelopment/bazar-stripe
- Owner: conedevelopment
- License: mit
- Created: 2023-10-26T07:45:17.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2025-03-27T20:57:04.000Z (12 months ago)
- Last Synced: 2025-07-05T22:17:21.828Z (9 months ago)
- Language: PHP
- Size: 85.9 KB
- Stars: 2
- Watchers: 4
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Bazar Stripe Payment Gateway
## Installation
```sh
composer require conedevelopment/bazar-stripe
```
## Configuration
### `.env`
```ini
STRIPE_TEST_MODE=
STRIPE_API_KEY=
STRIPE_SECRET=
```
### Bazar Config
```php
// config/bazar.php
'gateway' => [
'drivers' => [
// ...
'stripe' => [
'test_mode' => env('STRIPE_TEST_MODE', false),
'api_key' => env('STRIPE_API_KEY'),
'secret' => env('STRIPE_SECRET'),
],
],
],
// ...
```
## Webhook Events
```sh
php artisan make:listener StripeWebhookHandler
```
```php
namespace App\Listeners;
use Cone\Bazar\Stripe\WebhookInvoked;
use Stripe\Event;
class StripeWebhookHandler
{
public function handle(WebhookInvoked $event): void
{
// https://stripe.com/docs/api/events/types
$callback = match ($event->event->type) {
'payment_intent.payment_failed' => function (Event $event): void {
// mark transaction as failed
},
'payment_intent.succeeded' => function (Event $event): void {
// mark transaction as completed and order as paid
},
default => function (): void {
//
},
};
call_user_func_array($callback, [$event->event]);
}
}
```
> [!TIP]
> If [Event Discovery](https://laravel.com/docs/master/events#event-discovery) is disabled, make sure the listener is bound to the `WebhookInvoked` event in your `EventServiceProvider`.