PHP code example of yasinkuyu / omnipay-paycell-sdk

1. Go to this page and download the library: Download yasinkuyu/omnipay-paycell-sdk 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/ */

    

yasinkuyu / omnipay-paycell-sdk example snippets


$gateway->setTestMode(true); // For test environment
$gateway->setTestMode(false); // For production environment

use Omnipay\Omnipay;

$gateway = Omnipay::create('PaycellSDK');
$gateway->setTestMode(true); // Enable test mode
$gateway->setApplicationName('PAYCELLTEST');
$gateway->setApplicationPwd('PaycellTestPassword');
$gateway->setSecureCode('PAYCELL12345');
$gateway->setEulaID(17);
$gateway->setMerchantCode(9998);
$gateway->setTerminalCode('XXXXXXXXX');

$transactionDateTime = date('YmdHis') . substr(microtime(), 2, 3);

$gateway->setReferenceNumber($transactionDateTime);
$gateway->setHostAccount("[email protected]");
$gateway->setPaymentSecurity("NON_THREED_SECURE"); // or "THREED_SECURE"
$gateway->setLanguage("tr");

$response = $gateway->purchase([
    'amount' => '10.00',
    'currency' => 'TRY',
])->send();

if ($response->isSuccessful()) {
    echo "Payment successful!";
    // Get tracking URL for redirect
    $trackingUrl = $response->getTrackingUrl();
}

$response = $gateway->query([
    'originalPaymentReferenceNumber' => $paymentReferenceNumber,
])->send();

if ($response->isSuccessful()) {
    echo "Transaction status: " . $response->getMessage();
}

$response = $gateway->refund([
    'amount' => '10.00',
    'currency' => 'TRY',
    'originalPaymentReferenceNumber' => $paymentReferenceNumber,
])->send();

$response = $gateway->reverse([
    'originalPaymentReferenceNumber' => $paymentReferenceNumber,
])->send();
bash
composer 
bash
php -S localhost:8000