Skip to content

Commit 1eb5664

Browse files
author
Mostafa Kamal
committed
subscription doc
1 parent e4678f3 commit 1eb5664

File tree

2 files changed

+106
-0
lines changed

2 files changed

+106
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ php artisan vendor:publish --provider="Code4mk\LaraStripe\LaraStripeServiceProvi
2424
* [Checkout doc](https://github.com/code4mk/lara-stripe/blob/master/doc/payment-checkout.md)
2525
* [Customer doc](https://github.com/code4mk/lara-stripe/blob/master/doc/customer.md)
2626
* [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
2728

2829
# Demo repo
2930

doc/subscription.md

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
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+
```

0 commit comments

Comments
 (0)