1
1
# Stripe and Stripe Connect for your Laravel App
2
2
3
- [ ![ Latest Version on Packagist] ( https://img.shields.io/packagist/v/finller /laravel-stripe.svg?style=flat-square )] ( https://packagist.org/packages/finller /laravel-stripe )
4
- [ ![ GitHub Tests Action Status] ( https://img.shields.io/github/actions/workflow/status/finller /laravel-stripe/run-tests.yml?branch=main&label=tests&style=flat-square )] ( https://github.com/finller /laravel-stripe/actions?query=workflow%3Arun-tests+branch%3Amain )
5
- [ ![ GitHub Code Style Action Status] ( https://img.shields.io/github/actions/workflow/status/finller /laravel-stripe/fix-php-code-style-issues.yml?branch=main&label=code%20style&style=flat-square )] ( https://github.com/finller /laravel-stripe/actions?query=workflow%3A"Fix+PHP+code+style+issues"+branch%3Amain )
6
- [ ![ Total Downloads] ( https://img.shields.io/packagist/dt/finller /laravel-stripe.svg?style=flat-square )] ( https://packagist.org/packages/finller /laravel-stripe )
3
+ [ ![ Latest Version on Packagist] ( https://img.shields.io/packagist/v/elegant /laravel-stripe.svg?style=flat-square )] ( https://packagist.org/packages/elegant /laravel-stripe )
4
+ [ ![ GitHub Tests Action Status] ( https://img.shields.io/github/actions/workflow/status/elegant /laravel-stripe/run-tests.yml?branch=main&label=tests&style=flat-square )] ( https://github.com/ElegantEngineeringTech /laravel-stripe/actions?query=workflow%3Arun-tests+branch%3Amain )
5
+ [ ![ GitHub Code Style Action Status] ( https://img.shields.io/github/actions/workflow/status/elegant /laravel-stripe/fix-php-code-style-issues.yml?branch=main&label=code%20style&style=flat-square )] ( https://github.com/ElegantEngineeringTech /laravel-stripe/actions?query=workflow%3A"Fix+PHP+code+style+issues"+branch%3Amain )
6
+ [ ![ Total Downloads] ( https://img.shields.io/packagist/dt/elegant /laravel-stripe.svg?style=flat-square )] ( https://packagist.org/packages/elegant /laravel-stripe )
7
7
8
- This is where your description should go. Limit it to a paragraph or two. Consider adding a small example.
8
+ A simple way to attach Stripe Customer and Account to your Model in Laravel.
9
+
10
+ - Stripe webhooks ready to use out of the box
11
+ - Access Stripe php sdk easily
9
12
10
13
## Installation
11
14
12
15
You can install the package via composer:
13
16
14
17
``` bash
15
- composer require finller /laravel-stripe
18
+ composer require elegant /laravel-stripe
16
19
```
17
20
18
21
You should publish and run the migrations with:
@@ -32,18 +35,70 @@ php artisan vendor:publish --tag="stripe-config"
32
35
This is the contents of the published config file:
33
36
34
37
``` php
38
+ use Elegant\Stripe\Commands\CreateStripeWebhooksCommand;
39
+ use Elegant\Stripe\ModelRepository;
40
+
35
41
return [
36
- ];
37
- ```
38
42
39
- Optionally, you can publish the views using
43
+ 'models' => [
44
+ 'accounts' => [
45
+ \App\Models\User::class,
46
+ ],
47
+ 'customers' => [
48
+ \App\Models\User::class,
49
+ ],
50
+ 'repository' => ModelRepository::class,
51
+ ],
52
+
53
+ 'cache' => [
54
+ 'accounts' => true,
55
+ 'customers' => false,
56
+ ],
57
+
58
+ 'key' => env('STRIPE_KEY'),
59
+
60
+ 'secret' => env('STRIPE_SECRET'),
61
+
62
+ 'version' => env('STRIPE_VERSION', '2024-04-10'),
63
+
64
+ /**
65
+ * This is only used for the CreateStripeWebhooksCommand
66
+ * You can add more webhooks directly from your Stripe Dashboard
67
+ */
68
+ 'webhooks' => [
69
+ [
70
+ 'url' => '/webhooks/stripe',
71
+ 'connect' => false,
72
+ 'enabled_events' => [
73
+ ...CreateStripeWebhooksCommand::DEFAULT_WEBHOOKS_EVENTS,
74
+ ],
75
+ ],
76
+ ],
77
+
78
+ ];
40
79
41
- ``` bash
42
- php artisan vendor:publish --tag=" laravel-stripe-views"
43
80
```
44
81
45
82
## Prepare your model
46
83
84
+ ### Setup your database
85
+
86
+ This package simply rely on columns you have to add to any Model having a stripe customer or account.
87
+ To do so, we provide a mirgation that will automatically add the required columns to your models.
88
+ To configure what models are related to stripe, you must edit the configs.
89
+
90
+ ### Add the right trait
91
+
92
+ Add ` HasStripeCustomer ` trait to your Model:
93
+
94
+ ``` php
95
+ class Organization extends Model
96
+ {
97
+ use HasStripeCustomer;
98
+ // ...
99
+ }
100
+ ```
101
+
47
102
## Configure Webhooks
48
103
49
104
### Configure Webhooks on Stripe
0 commit comments