Skip to content

Commit 90bce84

Browse files
author
Mostafa Kamal
committed
coupon doc
1 parent 1eb5664 commit 90bce84

File tree

3 files changed

+92
-3
lines changed

3 files changed

+92
-3
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ 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
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)
2829

2930
# Demo repo
3031

doc/coupon.md

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

doc/subscription.md

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
lara-stripe has `LaraStripeSubs` alias for subscription related task.
44

5-
#Methods
5+
# Methods
66

77
## `setup()` `required`
88

@@ -68,7 +68,19 @@ Subscription with a coupon
6868
coupon('coupon_code')
6969
```
7070

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`
7284

7385
* create the subscription and retrive created subscription data.
7486
* return `object`

0 commit comments

Comments
 (0)