5.2 KiB
Wise Payment Integration - Frontend Updates
Overview
Updated the KSA-ORACLE project's cardSelection component to support both Stripe and Wise payment methods, matching the implementation in the oracle project.
Changes Made
1. cardSelection.vue (resources/js/pages/cards/cardSelection.vue)
Added Wise Payment Support
- Updated
handleSelection()function to accept aproviderparameter ('stripe' | 'wise') - Added new
redirectToWisePayment()function that:- Creates a payment record via
/create-wise-paymentendpoint - Stores the
clientSessionIdin sessionStorage - Redirects to the Wise payment link
- Creates a payment record via
Updated UI
- Changed single payment buttons to dual payment buttons for 6-card and 18-card options
- 6-card option (9.99 €): Now shows two buttons side-by-side:
- "Stripe" button (outlined style)
- "Wise" button (filled style)
- 18-card option (99€): Now shows two buttons side-by-side:
- "Stripe" button (outlined style)
- "Wise" button (filled style)
2. WiseController.php (app/Http/Controllers/WiseController.php)
Added complete Wise payment controller with:
createPaymentSession()- Creates payment records and returns Wise payment linkshandleWebhook()- Processes Wise webhook notificationsvalidatePayment()- Manual payment validation for redirect flow- Webhook signature verification
- Support for different Wise event types
Configuration:
- Uses environment variables for payment links per draw count
- Stores payments with
payment_provider = 'wise' - Tracks payments via
client_session_idandwise_session_id
3. Routes (routes/web.php)
Added new Wise payment routes:
Route::post('/create-wise-payment', [WiseController::class, 'createPaymentSession']);
Route::post('/wise/webhook', [WiseController::class, 'handleWebhook']);
Route::get('/wise/validate-payment', [WiseController::class, 'validatePayment']);
Route::get('/wise/verify', function () {
return Inertia::render('wise/VerifyPayment');
})->name('wise.verify');
Updated /success route to:
- Check for pending Wise payments
- Redirect to Pending page if payment is still processing
- Pass
paymentProviderprop to success page
4. Frontend Views
Added new Vue components:
-
Pending.vue (
resources/js/pages/payments/Pending.vue)- Shows "Payment is being processed" message
- Polls payment status for Wise payments
- Auto-redirects when payment succeeds
-
VerifyPayment.vue (
resources/js/pages/wise/VerifyPayment.vue)- Manual payment verification page
- Allows users to check payment status
5. TypeScript Actions
Added WiseController.ts (resources/js/actions/App/Http/Controllers/WiseController.ts)
- Type-safe route helpers for Wise endpoints
- Auto-generated from Laravel routes
Environment Configuration
Add these variables to your .env file:
# Wise Payment Links (Simplified Integration)
WISE_PAYMENT_LINK_6_CARDS=https://wise.com/pay/r/YOUR_6_CARDS_LINK
WISE_PAYMENT_LINK_18_CARDS=https://wise.com/pay/r/YOUR_18_CARDS_LINK
# Wise Webhook Configuration
WISE_WEBHOOK_SECRET=your_webhook_secret_here
User Experience Flow
Stripe Flow (unchanged)
- User clicks "Stripe" button
- Backend creates Stripe checkout session
- User redirects to Stripe checkout page
- After payment, redirects back to
/success
Wise Flow (new)
- User clicks "Wise" button
- Backend creates payment record with
status='pending' - Returns Wise payment link URL
- Frontend stores
client_session_idin sessionStorage - User redirects to Wise payment page
- After payment on Wise, user returns to
/success - If payment still pending, shows Pending page
- Pending page polls backend until payment confirmed via webhook
- When confirmed, redirects to success page
Webhook Setup
To receive payment confirmations:
- Go to https://wise.com/settings/webhooks
- Create a new webhook
- Set URL to:
https://yourdomain.com/wise/webhook - Select event types:
transfer_state_changebalance_credit
- Copy the webhook secret to your
.envfile asWISE_WEBHOOK_SECRET
Testing
To test the integration:
- Configure test payment links in
.env - Start the development server
- Navigate to the card selection page
- Click "Wise" button for either 6 or 18 cards
- Complete payment on Wise
- Verify redirect back to success page
Payment Links Configuration
Get your Wise payment links:
- Log into your Wise business account
- Go to "Request payment" or "Payment Links"
- Create payment links for:
- 9.99 EUR (6 cards)
- 15.90 EUR (18 cards) - Update this value based on your pricing
- Copy the links and add to
.env
Database Fields Used
The following Payment model fields are used for Wise:
payment_provider= 'wise'wise_session_id- Unique session identifierclient_session_id- Client-side tracking IDwise_payment_id- Wise transaction ID (from webhook)status- Payment status (pending, succeeded, failed, etc.)amount- Payment amountcurrency- Payment currency (EUR)draw_count- Number of cards (6 or 18)
Integration Status: ✅ Complete Last Updated: October 14, 2025 Project: KSA-ORACLE (/media/creator/6226b912-8ba7-45dc-88a2-4b10d3dd1655/kandra/successkey/KSA-ORACLE)