PHP code example of dipnot / ptt-akilliesnaf-php

1. Go to this page and download the library: Download dipnot/ptt-akilliesnaf-php 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/ */

    

dipnot / ptt-akilliesnaf-php example snippets


use Dipnot\PttAkilliEsnaf\Config;

$config = new Config(true); // Don't forget to change it to "false" in production :)
$config->setClientId("1000000032");
$config->setApiUser("Entegrasyon_01");
$config->setApiPass("gkk4l2*TY112");

use Dipnot\PttAkilliEsnaf\Enum\Currency;
use Dipnot\PttAkilliEsnaf\Request\ThreeDPaymentRequest;

// $config = ...;

$orderId = "ORDERCODE" . time();

$threeDPaymentRequest = new ThreeDPaymentRequest($config);
$threeDPaymentRequest->setCallbackUrl("http://localhost/ptt-akilliesnaf-php/examples/callback.php");
$threeDPaymentRequest->setOrderId($orderId);
$threeDPaymentRequest->setAmount(1000);
$threeDPaymentRequest->setCurrency(Currency::TL);
$threeDPaymentRequest->setInstallmentCount(1);

try {
    $request = $threeDPaymentRequest->execute();
    
    

use Dipnot\PttAkilliEsnaf\Request\InquiryRequest;

// $config = ...;

$orderId = "SAMPLEORDERCODE";

$inquiryRequest = new InquiryRequest($config);
$inquiryRequest->setOrderId($orderId);

try {
    $request = $inquiryRequest->execute();