use Payven\Sdk\Client;
use Payven\Sdk\Config;
use Payven\Sdk\PayvenException;
$client = new Client(new Config([
'identity_url' => 'https://identity.payven.com.tr',
'api_url' => 'https://vpos.payven.com.tr', // checkout + iade
'merchant_api_url' => 'https://merchant.payven.com.tr', // webhook uçları
'tenant_slug' => 'magazaniz',
'client_id' => 'pvk-magazaniz-xxxx',
'client_secret' => '...',
'external_merchant_id' => '', // tek bayi ise boş
]));
try {
$session = $client->createCheckoutSession([
'amount' => 15000, // kuruş (150,00 TL)
'currency' => 'TRY',
'external_id' => '12345', // mağaza sipariş no
'success_url' => 'https://magaza.example/odeme/basarili?order=12345',
'cancel_url' => 'https://magaza.example/sepet',
], 'order-12345'); // Idempotency-Key (isteğe bağlı)
header('Location: ' . $session['checkout_url']);
} catch (PayvenException $e) {
// $e->getMessage(), $e->httpStatus (0 = ağ hatası)
}