PHP code example of tcgunel / omnipay-iyzico

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

    

tcgunel / omnipay-iyzico example snippets


$gateway = Omnipay::create('Iyzico');
$gateway->setPublicKey('your-public-key');
$gateway->setPrivateKey('your-private-key');
$gateway->setTestMode(true); // sandbox

  $response = $gateway->refund([
      'paymentId'  => 'iyzico-payment-id',
      'amount'     => '12.34',
      'currency'   => 'TRY',
      'language'   => 'tr',
      'clientIp'   => request()->ip(),
  ])->send();

  $response->isSuccessful(); // true / false
  $response->getMessage();   // error message on failure
  $data = $response->getData(); // RefundResponseModel
  

  $response = $gateway->cancel([
      'paymentId' => 'iyzico-payment-id',
      'language'  => 'tr',
      'clientIp'  => request()->ip(),
  ])->send();

  $response->isSuccessful();
  $data = $response->getData(); // CancelResponseModel