File tree Expand file tree Collapse file tree 2 files changed +106
-0
lines changed Expand file tree Collapse file tree 2 files changed +106
-0
lines changed Original file line number Diff line number Diff line change @@ -24,6 +24,7 @@ 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
28
28
29
# Demo repo
29
30
Original file line number Diff line number Diff line change
1
+ # Subscription
2
+
3
+ lara-stripe has ` LaraStripeSubs ` alias for subscription 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
+ ## ` customer() ` ` required `
20
+
21
+ which customer subscribe.
22
+
23
+ * [ create customer first] ( https://github.com/code4mk/lara-stripe/blob/master/doc/customer.md )
24
+
25
+ ``` php
26
+ customer('customer_id')
27
+ ```
28
+
29
+ ## ` plan() ` ` required `
30
+
31
+ Customer subscription which plan.
32
+
33
+ * [ create a plan first] ( https://github.com/code4mk/lara-stripe/blob/master/doc/customer.md )
34
+
35
+ ``` php
36
+ plan('plan_id')
37
+ ```
38
+
39
+ ## ` trialPlan() ` ` optional `
40
+
41
+ If want to set trial period from plan.
42
+
43
+ ``` php
44
+ trialPlan()
45
+ ```
46
+
47
+ ## ` trail() ` ` optional `
48
+
49
+ Set tril period for the subscription. This override the plan trail.
50
+
51
+ ``` php
52
+ trial(5)
53
+ ```
54
+
55
+ ## ` source() ` ` optional `
56
+
57
+ set source (card token generate from stipe.js).
58
+
59
+ ``` php
60
+ source('tok_***')
61
+ ```
62
+
63
+ ## ` coupon() ` ` optioanl `
64
+
65
+ Subscription with a coupon
66
+
67
+ ``` php
68
+ coupon('coupon_code')
69
+ ```
70
+
71
+ ## get() ` required `
72
+
73
+ * create the subscription and retrive created subscription data.
74
+ * return ` object `
75
+
76
+ ``` php
77
+ get()
78
+ ```
79
+
80
+ # ` Create a Subscription -> Full code `
81
+
82
+
83
+ ``` php
84
+ LaraStripeSubs::setup(['secret_key'=>'******'])
85
+ ->customer('customer_id')
86
+ ->plan('plan_id')
87
+ ->source('tok_***')
88
+ ->trialPlan()
89
+ ->coupon('coupon_id')
90
+ ->get();
91
+ ```
92
+
93
+ # ` Retrieve the subscription `
94
+
95
+ ``` php
96
+ LaraStripeSubs::setup(['secret_key'=>'******'])
97
+ ->retrieve('subs_id')
98
+ ```
99
+
100
+ # ` Cancel the subscription `
101
+
102
+ ``` php
103
+ LaraStripeSubs::setup(['secret_key'=>'******'])
104
+ ->cancel('subs_id')
105
+ ```
You can’t perform that action at this time.
0 commit comments