PHP code example of mews / laravel-pos

1. Go to this page and download the library: Download mews/laravel-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 / laravel-pos example snippets


'providers' => [
    // ...
    Mews\LaravelPos\LaravelPosServiceProvider::class,
]

'aliases' => [
    // ...
    'LaravelPos' => Mews\LaravelPos\Facades\LaravelPos::class,
]


$pos = \Mews\LaravelPos\Facades\LaravelPos::instance();

$pos->account([
    'bank'          => 'akbank',
    'model'         => 'regular',
    'client_id'     => 'XXXXX',
    'username'      => 'XXXXX',
    'password'      => 'XXXXX',
    'env'           => 'test',
]);

$order = [
    'id'            => 'unique-order-id-' . str_random(16),
    'name'          => 'John Doe', // optional
    'email'         => '[email protected]', // optional
    'user_id'       => '12', // optional
    'amount'        => (double) 100,
    'installment'   => '0',
    'currency'      => 'TRY',
    'ip'            => request()->ip(),
    'transaction'   => 'pay', // pay => Auth, pre PreAuth
];

$card = [
    'number'        => 'XXXXXXXXXXXXXXXX',
    'month'         => 'XX',
    'year'          => 'XX',
    'cvv'           => 'XXX',
];

$pos->prepare($order);

$payment = $pos->payment($card);

dd($payment->response);