A Laravel package for Vipps/MobilePay payment integration designed for Laravel applications using Flux UI, Livewire, TailwindCSS, and Filament. This package provides a seamless integration with Vipps and MobilePay payment services.
- 🚀 Easy Setup: Simple configuration and installation
- 💳 Payment Creation: Create Vipps payments with ease
- 🔐 Token Management: Automatic token refresh and caching
- 📡 Webhook Support: Easy webhook setup with Artisan command
- 🏗️ Laravel Integration: Full Laravel ecosystem support
- ⚡ Flux UI Compatible: Designed for Laravel Flux projects
- 🔴 Livewire Ready: Includes Livewire component examples
- 📊 Filament Integration: Ready-to-use Filament resources
- 🏛️ Modern Architecture: Clean, service-oriented design
- ⚙️ Comprehensive Config: All options in one config file
- PHP ^8.1
- Laravel ^10.0||^11.0||^12.0
- GuzzleHttp ^7.0
- Carbon ^2.0||^3.0
Add the following variables to your .env file:
VIPPS_CLIENT_ID=your_client_id
VIPPS_CLIENT_SECRET=your_client_secret
VIPPS_MERCHANT_SERIAL_NUMBER=your_merchant_serial_number
VIPPS_SUBSCRIPTION_KEY=your_subscription_key
VIPPS_CURRENCY=NOK
VIPPS_API_URL=https://apitest.vipps.no # For testing
# VIPPS_API_URL=https://api.vipps.no # For production
VIPPS_RETURN_URL=https://your-site.com/payment/callback
VIPPS_WEBHOOK_ID=your_webhook_id
VIPPS_WEBHOOK_SECRET=your_webhook_secretTo create a webhook, use the Artisan command:
php artisan vipps:webhookThis will guide you through the webhook creation process and provide you with the webhook ID and secret to add to your .env file.
You can install the package via composer:
composer require kwhorne/wirement-vippsYou can publish and run the migrations with:
php artisan vendor:publish --tag="wirement-vipps-migrations"
php artisan migrateYou can publish the config file with:
php artisan vendor:publish --tag="wirement-vipps-config"Optionally, you can publish the views using
php artisan vendor:publish --tag="wirement-vipps-views"use Wirement\Vipps\Services\PaymentService;
// Create a payment using the service
$paymentService = new PaymentService();
$paymentUrl = $paymentService->generatePaymentLink(
10000, // Amount in øre (100 NOK)
'order-123' // Invoice/Order number
);
// Redirect user to payment URL
return redirect()->to($paymentUrl);use Wirement\Vipps\Services\PaymentService;
$orderlines = [
[
'id' => '1',
'name' => 'Product name',
'quantity' => 1,
'price' => 100, // Price in NOK
'vat' => 0.25, // 25% VAT
],
];
$paymentService = new PaymentService();
$paymentUrl = $paymentService->generatePaymentLink(
10000, // Amount in øre
'order-123', // Invoice number
$orderlines // Optional order lines
);use Livewire\Component;
use Wirement\Vipps\Services\PaymentService;
class PaymentComponent extends Component
{
public function createPayment()
{
$paymentService = new PaymentService();
$paymentUrl = $paymentService->generatePaymentLink(
5000, // 50 NOK in øre
'order-' . time() // Invoice number
);
return redirect()->to($paymentUrl);
}
}use Filament\Resources\Resource;
use Wirement\Vipps\Services\PaymentService;
// In your Filament resource
Tables\Actions\Action::make('create_payment')
->label('Create Vipps Payment')
->action(function ($record) {
$paymentService = new PaymentService();
$paymentUrl = $paymentService->generatePaymentLink(
$record->total * 100, // Convert to øre
(string) $record->id // Invoice number
);
$record->update(['vipps_url' => $paymentUrl]);
})composer testPlease see CHANGELOG for more information on what has changed recently.
Please see CONTRIBUTING for details.
Please review our security policy on how to report security vulnerabilities.
The MIT License (MIT). Please see License File for more information.