Garanti BBVA Sanal Pos (GVP)
Garanti BBVA, GVP (Garanti Virtual POS) adlı XML tabanlı sanal pos altyapısı sunar. 3D Secure zorunlu ödeme, taksitli satış ve iade işlemlerini destekler.
API Bilgileri
- Test URL: https://sanalposprovtest.garanti.com.tr/VPServlet
- Canlı URL: https://sanalposprov.garanti.com.tr/VPServlet
- 3D Gate: https://sanalposprov.garanti.com.tr/servlet/gt3dengine
1. Hash Hesaplama
$terminal_id = '30691297';
$merchant_id = '7000679';
$prov_user_id = 'PROVAUT';
$prov_password = '123qweASD';
$order_id = uniqid('GRT-');
$amount = 10000;
$security_data = strtoupper(
sha1($prov_password . str_pad($terminal_id, 9, '0', STR_PAD_LEFT))
);
$hash_data = strtoupper(
sha1(
$order_id . $terminal_id . $amount
. $security_data
)
);
2. 3D Secure Başlatma
$post_data = [
'mode' => 'TEST',
'apiversion' => 'v0.01',
'terminalprovuserid' => $prov_user_id,
'terminaluserid' => $prov_user_id,
'terminalmerchantid' => $merchant_id,
'terminalid' => $terminal_id,
'txntype' => 'sales',
'txnamount' => $amount,
'txncurrencycode' => '949',
'txninstallmentcount' => '',
'orderid' => $order_id,
'successurl' => 'https://siteniz.com/odeme/basarili',
'errorurl' => 'https://siteniz.com/odeme/hata',
'secure3dhash' => $hash_data,
];
3. 3D Callback İşleme
if ($_POST['mdstatus'] === '1') {
$xml = '<GVPSRequest>
<Mode>TEST</Mode>
<Terminal>
<ProvUserID>PROVAUT</ProvUserID>
<HashData>' . $hash_data . '</HashData>
<ID>' . $terminal_id . '</ID>
<MerchantID>' . $merchant_id . '</MerchantID>
</Terminal>
<Transaction>
<Type>sales</Type>
<Amount>' . $amount . '</Amount>
<CurrencyCode>949</CurrencyCode>
</Transaction>
</GVPSRequest>';
$ch = curl_init('https://sanalposprov.garanti.com.tr/VPServlet');
curl_setopt($ch, CURLOPT_POSTFIELDS, 'data=' . $xml);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
}