Unofficial PHP wrapper for PTT Akıllı Esnaf API
We got a lot of help from the sample codes.
Only covers threeDSecure
(Ortak Ödeme Sayfası) and inquiry
(Ödeme Sorgulama)
threeDPayment
(3D ile Ödeme), void
(İptal), refund
(İade) or history
(İşlem Listeleme) are not our goal currently. We would be happy to see your contributions!
- PHP 5.6.36 or higher
- ext-curl
- ext-json
You can install via Composer.
composer require dipnot/ptt-akilliesnaf-php
You can see the full example in examples folder.
All request are needs a Config.
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();
?>
<h1>Response:</h1>
<?php
echo "<pre>";
print_r($request->getResponse());
echo "</pre>";
?>
<hr />
<h1>Payment iframe:</h1>
<iframe src="<?= $request->getIframeUrl() ?>" width="1010" height="480"></iframe>
<?php
} catch(Exception $e) {
echo $e->getMessage();
}
use Dipnot\PttAkilliEsnaf\Request\InquiryRequest;
// $config = ...;
$orderId = "SAMPLEORDERCODE";
$inquiryRequest = new InquiryRequest($config);
$inquiryRequest->setOrderId($orderId);
try {
$request = $inquiryRequest->execute();
?>
<h1>Response:</h1>
<?php
echo "<pre>";
print_r($request->getResponse());
echo "</pre>";
} catch(Exception $e) {
echo $e->getMessage();
}
While developing the package, the test cards in the official documentation were not working. So we contacted the authorities and got the following values for testing.
Value | |
---|---|
Card holder | Fill randomly |
Card number | 4159560047417732 |
Card expiry date (Month/Year) | 08/24 |
Card CVV | 123 |
3D Secure code | You can get it under the countdown timer on the 3D Secure page |