PHP code example of teknasyon / isbank

1. Go to this page and download the library: Download teknasyon/isbank 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/ */

    

teknasyon / isbank example snippets


$service = new \Teknasyon\Isbank\Services\MpiEnrollment\MpiEnrollmentService();

$service->params()
    ->setPurchaseAmount(0.01)
    ->setCurrency(949)
    ->setPan(51xxxxxxxxxx5531)
    ->setExpiryDate(2205) // YYMM
    ->setBrandName('mastercard') 
    ->setSuccessUrl('http://127.0.0.1/OK')
    ->setFailureUrl('http://127.0.0.1/ERROR')
    ->setRequestId('unique-request-id'); // verifyEnrollmentRequestId 

$response = $service->makeRequest()->getResponse();
echo $response->Status; // Y/N/E 


$data = []; // MPI success callback parametreleri ile dolu oldugunu farz edelim. 

$service = new \Teknasyon\Isbank\Services\VirtualPos\VirtualPosService();

$service->params()
    ->setEci($data['ECI']) // MPI'dan donen ECI
    ->setCavv($data['CAVV']) // MPI'dan donen Cavv
    ->setPan($data['Pan'])
    ->setExpiry(20 . $data['Expiry']) // YYYYMM
    ->setCvv(CARD_CVV) // callback gelene kadar session'da saklanmis olmali. 
    ->setCurrencyAmount(0.01) // 
    ->setCurrencyCode(949) // TL: 949
    ->setMpiTransactionId($data['VerifyEnrollmentRequestId']) 
    ->setTransactionId($data['VerifyEnrollmentRequestId']); 

$response = $service->makeRequest()->getResponse();
var_dump($response->isSuccessfull()); // true/false