diff --git a/app/Http/Controllers/BillingController.php b/app/Http/Controllers/BillingController.php index c4fd98e..4d13b4e 100644 --- a/app/Http/Controllers/BillingController.php +++ b/app/Http/Controllers/BillingController.php @@ -6,6 +6,7 @@ use Illuminate\Http\Request; use Stripe\Stripe; use Stripe\Customer; use Stripe\PaymentIntent; +use Stripe\PaymentMethod; use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Auth; @@ -29,9 +30,17 @@ class BillingController extends Controller 'amount' => $amount, 'currency' => 'usd', 'customer' => Auth::user()->customer_id, - 'metadata' => ['integration_check' => 'accept_a_payment'] + 'metadata' => ['transaction_id' => 'accept_a_payment'] ]); return $intent->client_secret; } + + public function getCards() { + Stripe::setApiKey(env('STRIPE_SECRET')); + return PaymentMethod::all([ + 'customer' => Auth::user()->customer_id, + 'type' => 'card' + ]); + } } diff --git a/config/services.php b/config/services.php index 2a1d616..cada514 100644 --- a/config/services.php +++ b/config/services.php @@ -30,4 +30,9 @@ return [ 'region' => env('AWS_DEFAULT_REGION', 'us-east-1'), ], + 'stripe' => [ + 'key' => env('STRIPE_KEY'), + 'secret' => env('STRIPE_SECRET'), + ], + ]; diff --git a/resources/js/panel/credits.vue b/resources/js/panel/credits.vue index f547e8c..55e8700 100644 --- a/resources/js/panel/credits.vue +++ b/resources/js/panel/credits.vue @@ -19,9 +19,8 @@
-
-

Payment Method

+

Select a payment method

Saved Card @@ -29,15 +28,19 @@
+ + + v-if="!selectSaved"> +
-
@@ -45,6 +48,7 @@ diff --git a/resources/js/panel/saved-cards.vue b/resources/js/panel/saved-cards.vue new file mode 100644 index 0000000..3a98a90 --- /dev/null +++ b/resources/js/panel/saved-cards.vue @@ -0,0 +1,28 @@ + + + diff --git a/resources/scss/main.scss b/resources/scss/main.scss index af88130..0593ba2 100644 --- a/resources/scss/main.scss +++ b/resources/scss/main.scss @@ -1252,3 +1252,12 @@ div#card-errors { border-radius: 2px; } } + +.saved-card { + display: flex; + gap: 15px; + align-items: center; + justify-content: space-around; + max-width: 15em; + margin: auto; +} diff --git a/routes/web.php b/routes/web.php index 274429f..1f1bb4a 100644 --- a/routes/web.php +++ b/routes/web.php @@ -89,3 +89,6 @@ Route::post('/panel/orders', [TransactionController::class, Route::post('/panel/secret', [BillingController::class, 'secret'])->middleware([ 'auth', 'verified' ]); + +Route::get('/panel/cards', [BillingController::class, + 'getCards'])->middleware([ 'auth', 'verified' ]);