PHP code example of mews / pos

1. Go to this page and download the library: Download mews/pos library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

mews / pos example snippets


// 1. Banka hesabı oluşturunuz (her banka için farklı bir factory metodu vardır)
$account = \Mews\Pos\Factory\AccountFactory::createAkbankPosAccount(
    'akbank-pos',
    'MERCHANT_SAFE_ID',
    'TERMINAL_SAFE_ID',
    'SECRET_KEY'
);

// 2. Event dispatcher oluşturunuz (symfony/event-dispatcher önerilir)
// Elinizde farklı PSR-14 uygumlu EventDispatcher var ise kullanabilirsiniz.
$eventDispatcher = new \Symfony\Component\EventDispatcher\EventDispatcher();

// 3. Ayarları yükleyip ilgili bankanın dilimini alınız
$yeniAyarlar = 



return [
    // Banka sanal pos tanımlamaları
    'banks'         => [
        'akbank'    => [
            // AKBANK T.A.S.
            'class' => \Mews\Pos\Gateway\AssecoPos::class,
            'lang'  => \Mews\Pos\PosInterface::LANG_TR, // optional
            'gateway_endpoints'  => [
                'payment_api'     => 'https://www.sanalakpos.com/fim/api',
                'gateway_3d'      => 'https://www.sanalakpos.com/fim/est3Dgate',
                'gateway_3d_host' => 'https://sanalpos.sanalakpos.com.tr/fim/est3Dgate',
            ],
        ],

        // Yeni eklenen banka
        'isbank'    => [ // unique bir isim vermeniz gerekir.
            // İŞ BANKASI .A.S.
            'class' => \Mews\Pos\Gateway\AssecoPos::class, // Altyapı sınıfı
            'lang'  => \Mews\Pos\PosInterface::LANG_TR, // optional
            'gateway_endpoints'  => [
                'payment_api'     => 'https://sanalpos.isbank.com.tr/fim/api',
                'gateway_3d'      => 'https://sanalpos.isbank.com.tr/fim/est3Dgate',
            ],
        ],
    ]
];

$handler = new \Monolog\Handler\StreamHandler(__DIR__.'/../var/log/pos.log', \Psr\Log\LogLevel::DEBUG);
$logger = new \Monolog\Logger('pos', [$handler]);
$pos = \Mews\Pos\Factory\PosFactory::create(
    $account,
    $config['banks'][$account->getBankName()],
    $eventDispatcher,
    null,
    null,
    $logger
);
sh
$ cp ./vendor/mews/pos/config/pos_production.php ./pos_prod_ayarlar.php
sh
$ cp ./vendor/mews/pos/config/pos_test.php ./pos_test_ayarlar.php