PHP code example of mews / paytr

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


$payment = new Mews\PayTr\Payment(
    

$payment = new Mews\PayTr\Payment([
    'apiUrl' => 'https://www.paytr.com/odeme/api/get-token',
    'merchantId' => 'XXXXXX',
    'merchantKey' => 'XXXXXXXXXXXX',
    'merchantSalt' => 'XXXXXXXXXXXX',
    'successUrl' => 'https://paytr.test/example/index.php?status=success',
    'failUrl' => 'https://paytr.test/example/index.php?status=fail',
]);

$payment = new Mews\PayTr\Payment();
$payment->setConfig(new Mews\PayTr\Config([
    'apiUrl' => 'https://www.paytr.com/odeme/api/get-token',
    'merchantId' => 'XXXXXX',
    'merchantKey' => 'XXXXXXXXXXXX',
    'merchantSalt' => 'XXXXXXXXXXXX',
    'successUrl' => 'https://paytr.test/example/index.php?status=success',
    'failUrl' => 'https://paytr.test/example/index.php?status=fail',
]));