Skip to content

Commit 7887ae5

Browse files
Add support for Client Side Tokens (#245)
* add .idea folder to .gitignore, used by PhpStorm and other Jetbrain IDEs. * Add ability to provide client_side_token instead of seller_id, the client side token will take precedence over the seller id, as you cannot specify both. * Update .gitignore * Update js.blade.php --------- Co-authored-by: Taylor Otwell <taylor@laravel.com>
1 parent c391336 commit 7887ae5

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

config/cashier.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515

1616
'seller_id' => env('PADDLE_SELLER_ID'),
1717

18+
'client_side_token' => env('PADDLE_CLIENT_SIDE_TOKEN'),
19+
1820
'api_key' => env('PADDLE_AUTH_CODE') ?? env('PADDLE_API_KEY'),
1921

2022
'retain_key' => env('PADDLE_RETAIN_KEY'),

resources/views/js.blade.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
11
<?php
2+
23
$seller = array_filter([
3-
'seller' => (int) config('cashier.seller_id'),
44
'pwAuth' => (int) config('cashier.retain_key'),
55
]);
66
7+
if (config('cashier.client_side_token')) {
8+
$seller['token'] = config('cashier.client_side_token');
9+
} elseif (config('cashier.seller_id')) {
10+
$seller['seller'] = (int) config('cashier.seller_id');
11+
}
12+
713
if (isset($seller['pwAuth']) && Auth::check() && $customer = Auth::user()->customer) {
814
$seller['pwCustomer'] = ['id' => $customer->paddle_id];
915
}

0 commit comments

Comments
 (0)