Skip to content

Commit c252942

Browse files
committed
currency
1 parent d291d4c commit c252942

File tree

1 file changed

+16
-18
lines changed

1 file changed

+16
-18
lines changed

src/Lib/StripeCheckout.php

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -13,21 +13,7 @@ class StripeCheckout
1313
*
1414
* @var string length 3 and lowercase
1515
*/
16-
private $currency = 'usd';
17-
18-
/**
19-
* Checkout description.
20-
*
21-
* @var string
22-
*/
23-
private $description = 'Stripe payment checkout';
24-
25-
/**
26-
* Checkout products data.
27-
*
28-
* @var array
29-
*/
30-
private $products = [];
16+
private $theCurrency = 'usd';
3117

3218
/**
3319
* Secret key.
@@ -76,7 +62,7 @@ class StripeCheckout
7662

7763
public function __construct()
7864
{
79-
$this->currency = config('stripe.currency');
65+
$this->theCurrency = config('stripe.currency');
8066
$this->secretKey = config('stripe.secret_key');
8167
$this->publicKey = config('stripe.public_key');
8268
$this->successURI = config('stripe.success_url');
@@ -94,7 +80,6 @@ public function __construct()
9480
public function tnx($data)
9581
{
9682
$this->referenceKey = $data;
97-
$this->theDescription = $data;
9883

9984
return $this;
10085
}
@@ -138,6 +123,19 @@ public function amount($data)
138123
return $this;
139124
}
140125

126+
/**
127+
* Set currency.
128+
*
129+
* @param $data.
130+
* @return $this
131+
*/
132+
public function currency($data)
133+
{
134+
$this->theCurrency = $data;
135+
136+
return $this;
137+
}
138+
141139
/**
142140
* Get session id and public key
143141
*
@@ -155,7 +153,7 @@ public function get()
155153
// Line items.
156154
$this->checkoutData['line_items'] = [[
157155
'price_data' => [
158-
'currency' => $this->currency,
156+
'currency' => $this->theCurrency,
159157
'unit_amount' => $this->amount * 100, // Amount in cents (400 USD * 100)
160158
'product_data' => [
161159
'name' => $this->theTitle],

0 commit comments

Comments
 (0)