1. Go to this page and download the library: Download tcgunel/omnipay-tami 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/ */
$response = $gateway->purchase([
'amount' => '100.00',
'currency' => 'TRY',
'transactionId' => 'ORDER-123',
'installment' => 1,
'secure' => true,
'returnUrl' => 'https://merchant.example/orders/ORDER-123/verify-payment',
'card' => [ /* ... */ ],
'clientIp' => '127.0.0.1',
])->send();
if ($response->isRedirect()) {
// Tami returns base64-encoded HTML for the bank's 3D page.
// PurchaseResponse::getRedirectResponse() decodes it and returns a
// ready-to-emit Symfony HttpResponse — Omnipay's standard pattern works:
return $response->getRedirectResponse();
// Or pull the raw HTML if you need to embed it differently:
// echo $response->getRedirectHtml();
}
$notification = $gateway->acceptNotification($_POST);
if (! $notification->isSuccessful()) {
return failure_view($notification->getMessage());
}
if (! $notification->verifyHash($merchantStorekey)) {
return failure_view('3DS hash verification failed');
}
// 3DS challenge succeeded — finalize the charge.
$completion = $gateway->completePurchase([
'transactionId' => $notification->getTransactionId(),
])->send();
if ($completion->isSuccessful()) {
// Charge captured. $completion->getTransactionReference() = bank ref number.
}