mews/laravel-pos
| Install | |
|---|---|
composer require mews/laravel-pos |
|
| Latest Version: | 2.0.0 |
| PHP: | >=8.0 |
| License: | MIT |
| Last Updated: | Jul 16, 2026 |
| Links: | GitHub · Packagist |
Türk bankaları için sanal pos paketi (Laravel)
Temel Paket
Ana başlıklar
- Minimum Gereksinimler
- Kurulum
- Gateway'lere Erişim
- PosQuery Kullanımı
- Kullanım (3D Secure Ödeme)
- Troubelshoots
- Konfigurasyon Yapısı ve Örnekler
- v1'den v2'ye Geçiş
Minimum Gereksinimler
- PHP >= 8.0
- mews/pos ^2.0
- Laravel >= v8
Kurulum
-
$ composer require mews/laravel-pos $ php artisan vendor:publish --tag=laravel-pos -
/config/laravel-pos.phpayarınızı elinizde gateway bilgileri göre güncelleyiniz. Örnek konfigurasyon:<?php # /config/laravel-pos.php return [ 'banks' => [ # array keyleri unique olmalıdır 'kuveytpos' => [ # ilk sıradaki banka injection için default olur. 'gateway_class' => \Mews\Pos\Gateway\KuveytPos::class, 'credentials' => [ 'merchant_id' => 'xxx', 'terminal_id' => 'yyyyyyy', // CustomerId 'user_name' => 'zzzzzzz', 'secret_key' => 'www123', ], 'gateway_configs' => [ 'test_mode' => true, ], 'gateway_endpoints' => [ 'payment_api' => 'https://boatest.kuveytturk.com.tr/boa.virtualpos.services/Home', 'query_api' => 'https://boatest.kuveytturk.com.tr/BOA.Integration.WCFService/BOA.Integration.VirtualPos/VirtualPosService.svc/Basic', ], ], 'asseco_payten' => [ 'gateway_class' => \Mews\Pos\Gateway\AssecoPos::class, 'credentials' => [ 'merchant_id' => '7001132146464', 'user_name' => 'ISBXXXXX', 'user_password' => 'ISBYYYYY', 'secret_key' => 'TRPZZZZZ', ], 'gateway_endpoints' => [ 'payment_api' => 'https://entegrasyon.asseco-see.com.tr/fim/api', 'gateway_3d' => 'https://entegrasyon.asseco-see.com.tr/fim/est3Dgate', 'gateway_3d_host' => 'https://sanalpos.sanalakpos.com.tr/fim/est3Dgate', ], ], ], ]; -
PHP Session kullanıyorsanız 3D ödemeler için session'i alttaki şekilde ayarlamanız gerekir.
Laravel 11 ve üzeri için environment değişkenleri şu şekilde olacak:
SESSION_SECURE_COOKIE=true SESSION_SAME_SITE=Lax # ya da SESSION_SAME_SITE=None deneyiniz.Laravel 10, 9, 8 için ise
- Environment'da
SESSION_SECURE_COOKIE=trueyapılacak - Ve
/config/session.php'desame_sitedeğeri güncellenecek:# /config/session.php: return [ // ... 'same_site' => 'lax', # ya da 'none' deneyiniz. ]
Değişikliklerden sonra var olan session'i silip yeni session oluşturunuz.
- Environment'da
-
3D ödemelerde bankadan websiteye geri redirect edilecek URL'larda (success/fail URL'lar) CSRF kapatılması gerekir.
Laravel 11 ve üzeri
withMiddleware()method'la ayarı yapabilirsiniz.<?php # /bootstrap/app.php use Illuminate\Foundation\Application; use Illuminate\Foundation\Configuration\Exceptions; use Illuminate\Foundation\Configuration\Middleware; return Application::configure(basePath: dirname(__DIR__)) // ... ->withMiddleware(function (Middleware $middleware) { $middleware->validateCsrfTokens(except: [ '/payment/3d/response' ]); });Laravel 10, 9, 8 ise
/app/Http/Middleware/VerifyCsrfToken.php'de ayarlayabilirsiniz.<?php # /app/Http/Middleware/VerifyCsrfToken.php namespace App\Http\Middleware; use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken as Middleware; class VerifyCsrfToken extends Middleware { protected $except = [ // success ve fail URL'lar buraya eklenecek: '/payment/3d/response', ]; }
Gateway'lere Erişim
Birden fazla banka yapılandırıldığında GatewayRegistry veya LaravelPos
facade'i ile gateway'e erişebilirsiniz:
use Mews\LaravelPos\GatewayRegistry;
use Mews\LaravelPos\Facades\LaravelPos;
// Constructor injection
public function __construct(private GatewayRegistry $gatewayRegistry) {}
$pos = $this->gatewayRegistry->gateway('kuveytpos'); // PosInterface
// Facade
$pos = LaravelPos::gateway('kuveytpos');
// Tüm gateway'ler
$all = $this->gatewayRegistry->all(); // PosInterface[]
Tek banka yapılandırıldığında PosInterface doğrudan inject edilebilir:
public function __construct(private \Mews\Pos\PosInterface $pos) {}
Bilinmeyen bir $bankKey verilirse \InvalidArgumentException fırlatılır.
Troubleshoots
- Error: "cURL error 60: SSL certificate problem: unable to get local issuer certificate (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) for https://..." Genellikle lokal ortamda bu sorunla karşılaşabilirsiniz. Lokal ortamınızda CA certificate bulunmadığında oluşur. Bu durumda sunucuda çalıştırmayı deneyiniz.
License
MIT
Related Packages
Powerful PHP database abstraction layer (DBAL) with many features for database s...
Laravel Serializable Closure provides an easy and secure way to serialize closur...
Cli error handling for console/command-line PHP applications.
Version History
| Version | Released | PHP | Laravel | License |
|---|---|---|---|---|
| 2.0.0 | >=8.0 | ^8.0| | MIT | |
| 1.4.0 | >=7.4 | ^8.0| | MIT | |
| 1.3.0 | >=7.4 | ^8.0| | MIT | |
| 1.2.0 | >=7.4 | ^8.0| | MIT | |
| 1.1.0 | >=7.4 | ^8.0| | MIT | |
| 1.0.1 | >=7.4 | ^8.0| | MIT | |
| 1.0.0 | >=7.4 | ^8.0| | MIT | |
| 0.3.9 | >=7.1.3 | ~5.7| | MIT | |
| 0.3.8 | ^7.1.3 | ~5.7| | MIT | |
| 0.3.7 | ^7.1.3 | ~5.7| | MIT | |
| 0.3.6 | ^7.1.3 | ~5.7| | MIT | |
| 0.3.5 | ^7.1.3 | ~5.7| | MIT | |
| 0.3.4 | ^7.1.3 | ~5.7| | MIT | |
| 0.3.3 | ^7.1.3 | ~5.7| | MIT | |
| 0.3.2 | ^7.1.3 | ~5.7| | MIT | |
| 0.3.1 | ^7.1.3 | ~5.7| | MIT | |
| 0.3.0 | ^7.1.3 | ~5.7| | MIT | |
| 0.2.0 | ^7.1.3 | ~5.5| | MIT | |
| 0.1.8 | ^7.1.3 | ~5.5| | MIT | |
| 0.1.7 | ^7.1.3 | ~5.5| | MIT | |
| 0.1.6 | ^7.1.3 | ~5.5| | MIT | |
| 0.1.5 | ^7.1.3 | ~5.5| | MIT | |
| 0.1.4 | ^7.1.3 | ~5.5| | MIT | |
| 0.1.2 | >=7.1.3 | ~5.5| | MIT | |
| 0.1.0 | >=7.1.3 | ~5.5| | MIT |