curl -X POST https://api.yucepay.com/api/payment/hostedpage \
-H "X-Api-Key: pk_live_xxxxxxxxxxxxxxxx" \
-H "Content-Type: application/json" \
-d '{
"amount": 320.00,
"currency": "TRY",
"installment": 1,
"successUrl": "https://magaza.com/basarili",
"failUrl": "https://magaza.com/hata",
"orderNumber": "SIP-10600",
"products": [ { "id": "SKU-3", "name": "Sepet", "amount": 320.00 } ]
}'
var body = new {
amount = 320.00m, currency = "TRY", installment = 1,
successUrl = "https://magaza.com/basarili", failUrl = "https://magaza.com/hata",
orderNumber = "SIP-10600",
products = new[] { new { id = "SKU-3", name = "Sepet", amount = 320.00m } }
};
var res = await http.PostAsJsonAsync("https://api.yucepay.com/api/payment/hostedpage", body);
// data.hostedPageUrl adresine yönlendirin veya iframe içinde açın
<?php
$ch = curl_init('https://api.yucepay.com/api/payment/hostedpage');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true, CURLOPT_POST => true,
CURLOPT_HTTPHEADER => ['X-Api-Key: pk_live_xxxxxxxxxxxxxxxx','Content-Type: application/json'],
CURLOPT_POSTFIELDS => json_encode([
'amount' => 320.00, 'currency' => 'TRY', 'installment' => 1,
'successUrl' => 'https://magaza.com/basarili', 'failUrl' => 'https://magaza.com/hata',
'orderNumber' => 'SIP-10600',
'products' => [['id' => 'SKU-3','name' => 'Sepet','amount' => 320.00]],
]),
]);
$response = curl_exec($ch);
const res = await fetch('https://api.yucepay.com/api/payment/hostedpage', {
method: 'POST',
headers: { 'X-Api-Key': 'pk_live_xxxxxxxxxxxxxxxx', 'Content-Type': 'application/json' },
body: JSON.stringify({
amount: 320.00, currency: 'TRY', installment: 1,
successUrl: 'https://magaza.com/basarili', failUrl: 'https://magaza.com/hata',
orderNumber: 'SIP-10600',
products: [{ id: 'SKU-3', name: 'Sepet', amount: 320.00 }],
}),
});
const data = await res.json();
// window.location = data.data.hostedPageUrl;
{
"success": true,
"message": "Ödeme sayfası oluşturuldu",
"data": {
"token": "HST-eyJwYXltZW50SWQiOiI...",
"hostedPageUrl": "https://pay.yucepay.com/iframe/HST-eyJwYXltZW50SWQiOiI...",
"expiresAt": "2026-08-19T11:02:00Z"
},
"errorCode": null,
"timestamp": "2026-08-19T10:32:00Z"
}