Skip to content

Commit d291d4c

Browse files
committed
code style
1 parent 0322c9c commit d291d4c

19 files changed

+581
-491
lines changed

config/stripe.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@
99
'secret_key' => env('STRIPE_SECRET_KEY'),
1010
'public_key' => env('STRIPE_PUBLIC_KEY'),
1111
'success_url' => env('STRIPE_SUCCESS_URL'),
12-
'cancel_url' => env('STRIPE_CANCEL_URL')
13-
];
12+
'cancel_url' => env('STRIPE_CANCEL_URL'),
13+
];

doc/payment-checkout.md

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

33
LaraStripe has payment checkout (session) alias `LaraStripeCheckout`.
44

5-
# Methods
6-
7-
## setup
8-
9-
`setup` method has `secret,public_key,currency` properties as `array`.
10-
11-
```php
12-
LaraStripeCheckout::setup([
13-
'secret_key' => '********',
14-
'public_key' => '****',
15-
'currency' => 'usd'
16-
])
17-
```
18-
19-
## configure
20-
21-
`configure` method has `success_url,cancel_url,ref_id`.
22-
23-
* `ref_key` can be a `customer ID`, a `cart ID`, or `similar`, and can be used to `reconcile` the session with your internal systems.
24-
25-
```php
26-
LaraStripeCheckout::configure([
27-
'success_url' => 'http://test.co/success?session_id={CHECKOUT_SESSION_ID}',
28-
'cancel_url' => 'http://test.co'
29-
'ref_key' => 'tnx_4345623232'
30-
])
31-
```
32-
33-
## products
34-
35-
`products` method has
36-
* `name <required>` `sring`
37-
* `description <optional>` `string`
38-
* `images <optional>` `array`
39-
* `amount <required>` `number`
40-
* `quantity <optional>` `integer`
41-
* default quantity is 1 . if you add qunatity that will be multiplication with amount `ex amount $20 and quantity 2 that time stripe payment total amount will be $20 * 2 = $40`
42-
43-
44-
```php
45-
LaraStripeCheckout::products([
46-
[
47-
'name' => 'T-shirt',
48-
'description' => 'Banladeshi T-shirt model 23',
49-
'images' => ['https://cdn.pixabay.com/photo/2016/12/06/09/31/blank-1886008_960_720.png'],
50-
'amount' => 20.50,
51-
'quantity' => 2
52-
],
53-
[
54-
'name' => 'Mobile',
55-
'amount' => 150
56-
]
57-
])
58-
```
59-
60-
## getSession
61-
62-
getSession method return session id (`sid`) and public key (`pkey`) . session id as like `cs_test_k8ep1Z7ndlRmAgl0JU0m7SciO8QjSpoFjAIDheeCtCflp4gRdBShozOs` and public key as `pk_test_VNi7F1zcwwffZIi1tAkX1dVs00JfKPsCGR`.
63-
64-
* `type object`
65-
* pass this data with view
66-
67-
```php
68-
LaraStripeCheckout::getSession()
69-
```
70-
71-
## full code LaraStripeCheckout
72-
73-
* session_id genereate
5+
# Usage
746

757
```php
76-
$session = LaraStripeCheckout::setup([
77-
'secret' => '********',
78-
'public_key' => '****',
79-
'currency' => 'usd'
80-
])
81-
->configure([
82-
'success_url' => 'http://test.co/success?session_id={CHECKOUT_SESSION_ID}',
83-
'cancel_url' => 'http://test.co'
84-
'ref_id' => 'tnx_4345623232'
85-
])
86-
->products([
87-
[
88-
'name' => 'T-shirt',
89-
'description' => 'Banladeshi T-shirt model 23',
90-
'images' => ['https://cdn.pixabay.com/photo/2016/12/06/09/31/blank-1886008_960_720.png'],
91-
'amount' => 20.50,
92-
'quantity' => 2
93-
],
94-
[
95-
'name' => 'Mobile',
96-
'amount' => 150
97-
]
98-
])
99-
->getSession();
100-
// return view('checkout',['session' => $session]);
101-
// return response()->json($session)
8+
$checkout = LaraStripeCheckout::tnx('tnx-1212134')
9+
->amount(233)
10+
->get();
11+
return response()->json($checkout);
12+
13+
// output
14+
{
15+
"session_id":"cs_test_bhbhbbh",
16+
"public_key": "pk_test_uiuiui",
17+
"checkout_url": ""
18+
}
10219
```
10320

10421
# stripe.js
@@ -130,8 +47,8 @@ stripe.redirectToCheckout({
13047
* include `<script src="https://js.stripe.com/v3/"></script>`
13148

13249
```js
133-
var publicKey = '{{ $session->pkey }}'
134-
var SessionId = '{{ $session->sid }}'
50+
var publicKey = '{{ $session->public_key }}'
51+
var SessionId = '{{ $session->session_id }}'
13552
var stripe = Stripe(publicKey);
13653

13754
stripe.redirectToCheckout({

src/Facades/LStripeBalance.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@
1212

1313
class LStripeBalance extends Facade
1414
{
15-
/**
16-
* Get the registered name of the component.
17-
*
18-
* @return string
19-
*/
20-
protected static function getFacadeAccessor()
21-
{
22-
return 'laraStripeBalance';
23-
}
15+
/**
16+
* Get the registered name of the component.
17+
*
18+
* @return string
19+
*/
20+
protected static function getFacadeAccessor()
21+
{
22+
return 'laraStripeBalance';
23+
}
2424
}

src/Facades/LStripeCharge.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@
1212

1313
class LStripeCharge extends Facade
1414
{
15-
/**
16-
* Get the registered name of the component.
17-
*
18-
* @return string
19-
*/
20-
protected static function getFacadeAccessor()
21-
{
22-
return 'laraStripeCharge';
23-
}
15+
/**
16+
* Get the registered name of the component.
17+
*
18+
* @return string
19+
*/
20+
protected static function getFacadeAccessor()
21+
{
22+
return 'laraStripeCharge';
23+
}
2424
}

src/Facades/LStripeCheckout.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@
1212

1313
class LStripeCheckout extends Facade
1414
{
15-
/**
16-
* Get the registered name of the component.
17-
*
18-
* @return string
19-
*/
20-
protected static function getFacadeAccessor()
21-
{
22-
return 'laraStripeCheckout';
23-
}
15+
/**
16+
* Get the registered name of the component.
17+
*
18+
* @return string
19+
*/
20+
protected static function getFacadeAccessor()
21+
{
22+
return 'laraStripeCheckout';
23+
}
2424
}

src/Facades/LStripeCoupon.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@
1212

1313
class LStripeCoupon extends Facade
1414
{
15-
/**
16-
* Get the registered name of the component.
17-
*
18-
* @return string
19-
*/
20-
protected static function getFacadeAccessor()
21-
{
22-
return 'laraStripeCoupon';
23-
}
15+
/**
16+
* Get the registered name of the component.
17+
*
18+
* @return string
19+
*/
20+
protected static function getFacadeAccessor()
21+
{
22+
return 'laraStripeCoupon';
23+
}
2424
}

src/Facades/LStripeCustomer.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@
1212

1313
class LStripeCustomer extends Facade
1414
{
15-
/**
16-
* Get the registered name of the component.
17-
*
18-
* @return string
19-
*/
20-
protected static function getFacadeAccessor()
21-
{
22-
return 'laraStripeCustomer';
23-
}
15+
/**
16+
* Get the registered name of the component.
17+
*
18+
* @return string
19+
*/
20+
protected static function getFacadeAccessor()
21+
{
22+
return 'laraStripeCustomer';
23+
}
2424
}

src/Facades/LStripePlan.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@
1212

1313
class LStripePlan extends Facade
1414
{
15-
/**
16-
* Get the registered name of the component.
17-
*
18-
* @return string
19-
*/
20-
protected static function getFacadeAccessor()
21-
{
22-
return 'laraStripePlan';
23-
}
15+
/**
16+
* Get the registered name of the component.
17+
*
18+
* @return string
19+
*/
20+
protected static function getFacadeAccessor()
21+
{
22+
return 'laraStripePlan';
23+
}
2424
}

src/Facades/LStripeSubscription.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@
1212

1313
class LStripeSubscription extends Facade
1414
{
15-
/**
16-
* Get the registered name of the component.
17-
*
18-
* @return string
19-
*/
20-
protected static function getFacadeAccessor()
21-
{
22-
return 'laraStripeSubscription';
23-
}
15+
/**
16+
* Get the registered name of the component.
17+
*
18+
* @return string
19+
*/
20+
protected static function getFacadeAccessor()
21+
{
22+
return 'laraStripeSubscription';
23+
}
2424
}

0 commit comments

Comments
 (0)