File tree Expand file tree Collapse file tree 3 files changed +92
-3
lines changed Expand file tree Collapse file tree 3 files changed +92
-3
lines changed Original file line number Diff line number Diff line change @@ -24,7 +24,8 @@ php artisan vendor:publish --provider="Code4mk\LaraStripe\LaraStripeServiceProvi
24
24
* [ Checkout doc] ( https://github.com/code4mk/lara-stripe/blob/master/doc/payment-checkout.md )
25
25
* [ Customer doc] ( https://github.com/code4mk/lara-stripe/blob/master/doc/customer.md )
26
26
* [ Plan doc] ( https://github.com/code4mk/lara-stripe/blob/master/doc/plan.md )
27
- * [ Subscription doc] ( https://github.com/code4mk/lara-stripe/blob/master/doc/subscription.md ) a
27
+ * [ Subscription doc] ( https://github.com/code4mk/lara-stripe/blob/master/doc/subscription.md )
28
+ * [ Coupon doc] ( https://github.com/code4mk/lara-stripe/blob/master/doc/coupon.md )
28
29
29
30
# Demo repo
30
31
Original file line number Diff line number Diff line change
1
+ # Coupon
2
+
3
+ lara-stripe has ` LaraStripeCoupon ` alias for coupon related task.
4
+
5
+ #Methods
6
+
7
+ ## setup() ` required `
8
+
9
+ setup method as usual setup secret key
10
+
11
+ * ` secret_key ` required
12
+
13
+ ``` php
14
+ setup([
15
+ 'secret_key' => '********'
16
+ ])
17
+ ```
18
+
19
+ ## name() ` required `
20
+
21
+ Coupon name. Automatic convert camel_case
22
+
23
+ ``` php
24
+ name('launch_20')
25
+ ```
26
+
27
+ ## amount() ` required `
28
+
29
+ Set coupon amount and copoun type ` fixed/per ` fixed or percent.
30
+
31
+ * amount has 3 parameter amount (` required ` ) , type (` required ` ) and currency . ` currency is required when type is fixed `
32
+
33
+ ``` php
34
+ # percent
35
+ amount(20,'per')
36
+ # fixed
37
+ amount(20.50,'fixed','usd')
38
+ ````
39
+
40
+ ## duration() `required`
41
+
42
+ * duration has 2 parameter one is type another is month.
43
+ * type `required` `[forever,once,repeating]`
44
+ * if type `repeating` that time `month` is `required`. month is integer value.
45
+
46
+ ```php
47
+ duration('once')
48
+ # if repeating
49
+ duration('repeating',4)
50
+ ```
51
+
52
+ ## get() ` required `
53
+
54
+ * create the coupon and retrive created coupon data.
55
+ * return ` object `
56
+
57
+ ``` php
58
+ get()
59
+ ```
60
+
61
+ # ` Create coupon -> Full code `
62
+
63
+ ``` php
64
+ LaraStripeCoupon::setup(['secret_key' => '*****'])
65
+ ->name('launch_20')
66
+ ->amount(10,'per')
67
+ ->duration('month')
68
+ ->get()
69
+ ```
70
+
71
+ # ` Delete the coupon `
72
+
73
+ ``` php
74
+ LaraStripeCoupon::setup(['secret_key' => '*****'])
75
+ ->delete('coupon_id')
76
+ ```
Original file line number Diff line number Diff line change 2
2
3
3
lara-stripe has ` LaraStripeSubs ` alias for subscription related task.
4
4
5
- #Methods
5
+ # Methods
6
6
7
7
## ` setup() ` ` required `
8
8
@@ -68,7 +68,19 @@ Subscription with a coupon
68
68
coupon('coupon_code')
69
69
```
70
70
71
- ## get() ` required `
71
+ ## extra ` optional `
72
+
73
+ Add optional attributes which are not include this package for creating subscription.
74
+
75
+ * [ all attributes lists] ( https://stripe.com/docs/api/subscriptions/create )
76
+
77
+ ``` php
78
+ extra([
79
+ .....
80
+ ])
81
+ ```
82
+
83
+ ## ` get() ` ` required `
72
84
73
85
* create the subscription and retrive created subscription data.
74
86
* return ` object `
You can’t perform that action at this time.
0 commit comments