/api/payments/hostedIdempotency-Key zorunluÖdeme oluşturma
Yeni ödemeyle birlikte 201 döndürür. Aynı istek aynı Idempotency-Key ile yeniden gönderilirse aynı ödemeyle birlikte 200 döner.
İstek gövdesi
| Alan | Tür | Zorunlu | Açıklama | Örnek |
|---|---|---|---|---|
merchant_order_id | string | Zorunlu | Sipariş referansınız: A-Z a-z 0-9 . _ - karakterlerinden oluşan 1–64 karakter. Her referans, her ortamda yalnızca bir ödeme için kullanılabilir; bu kural ödeme başarısız olsa veya süresi dolsa da geçerlidir. Benzersizlik denetiminde büyük/küçük harf ayrımı yapılmaz: ORDER-1 ve order-1 aynı referans olarak değerlendirilir. | ORDER-2026-001 |
amount | string | Zorunlu | Başında sıfır olmayan, iki ondalık basamaklı pozitif tutar; örneğin "100.00". Hesabınızın tutar sınırları içinde olmalıdır. | "100.00" |
currency | string | İsteğe bağlı | Gönderilmezse sistemin ana para birimi uygulanır.USDEURAEDTRY | USD |
webhook_url | string · uri | Zorunlu | Bu ödemenin webhook'larını alan uç nokta. 443 portunda herkese açık HTTPS, en fazla 500 karakter, kullanıcı bilgisi ve parça (fragment) olmadan. Özel ve yerel adresler sandbox dahil kabul edilmez; alan adı istek anında herkese açık bir IP adresine çözülmelidir, aksi halde 422 9000008. | https://merchant.example/webhooks/payments |
success_url | string · uri | Zorunlu | Başarılı bir ödemeden sonra tarayıcının yönlendirileceği adres. HTTPS, en fazla 2048 karakter; kullanıcı bilgisi (user info) ve parça (fragment) içermemelidir. Sandbox ortamı http://localhost, 127.0.0.1 ve [::1] adreslerini de kabul eder. | https://merchant.example/payment/success |
fail_url | string · uri | Zorunlu | Ödeme başarısız olduğunda, süresi dolduğunda veya iptal edildiğinde tarayıcının yönlendirileceği adres. success_url için geçerli kurallar burada da uygulanır. | https://merchant.example/payment/failure |
customer | object | Zorunlu | Ödeyenin iletişim bilgileri; ödeme sonucu, makbuz ve bankanın doğrulama adımları için kullanılır. Yalnızca email ve phone kabul edilir; customer içindeki başka bir alan 422 1000001 ile reddedilir. | { … } |
customer.email | string | Zorunlu | Ödeyenin gerçek e-posta adresi: RFC 5322, en fazla 254 karakter, noktalı alan adı. Küçük harfe çevrilerek saklanır. | [email protected] |
customer.phone | string | Zorunlu | Ödeyenin gerçek telefon numarası, uluslararası biçimde (+ ülke kodu, E.164), örneğin +37061234567. Türkiye'ye özgü kural: +90 ve 10 haneli ulusal numara (5xx cep, 2xx, 3xx, 4xx sabit, 8xx özel). Ülke kodu verilmeyen numara Türkiye numarası (+90) sayılır. | +37061234567 |
Bu üç URL yalnızca bu ödeme için geçerlidir ve panel ayarlarınızdan alınmaz.
Ödeme sayfası ödeyenden e-posta adresini ve telefon numarasını yeniden istemez. Gizlilik gereği customer ödeme nesnesinde ve webhook'larda döndürülmez.
| Alan | Neden | errors içindeki mesaj |
|---|---|---|
customer.email | Biçim geçersiz veya 254 karakterden uzun. | customer.email must be a valid e-mail address (max 254 characters). |
customer.email | Yer tutucu, örnek veya tek kullanımlık adres. | customer.email must be the payer's real address; placeholder, example or disposable addresses (example.com, test@…, mailinator…) are not accepted. |
customer.phone | Uluslararası biçimde geçerli bir numara değil. | customer.phone must be a valid phone number in international format (e.g. +37061234567). |
customer.phone | Yinelenen veya ardışık rakam deseni. | customer.phone must be the payer's real number; repeated or sequential digit patterns (5555555555, 1234567890) are not accepted. |
customer.phone | Türkiye numarası +90 ve 2, 3, 4, 5 veya 8 ile başlayan 10 hane biçiminde değil. | customer.phone for Türkiye must be +90 followed by a 10-digit number starting with 2, 3, 4, 5 or 8 (e.g. +905321234567). |
HTTP 422 · 1000001
{
"type": "https://payniko.com/problems/1000001",
"title": "Validation failed",
"status": 422,
"detail": "The submitted fields are not valid.",
"code": "1000001",
"correlation_id": "4c7a1e9d-2b3f-4d85-9a6e-0f1b2c3d4e5f",
"errors": {
"customer.email": [
"customer.email must be the payer's real address; placeholder, example or disposable addresses (example.com, test@…, mailinator…) are not accepted."
],
"customer.phone": [
"customer.phone must be the payer's real number; repeated or sequential digit patterns (5555555555, 1234567890) are not accepted."
]
}
}İstek customer yüzünden reddedilirse nedeni ödeyene açıkça gösterin (örneğin: kendi e-posta adresinizi veya telefon numaranızı girin) ve ödemeyi yeniden oluşturmadan önce alanı düzeltmesine izin verin. errors içindeki mesajlar İngilizcedir; günlükleriniz ve destek için tasarlanmıştır.
Payniko ödeme linki sayfaları, ödeyenin orada girdiği e-posta adresi ve telefon numarasına aynı kuralları uygular ve ret nedenini ödeyene gösterir.
İstek gövdesi · Örnek
{
"merchant_order_id": "ORDER-2026-001",
"amount": "100.00",
"currency": "USD",
"webhook_url": "https://merchant.example/webhooks/payments",
"success_url": "https://merchant.example/payment/success",
"fail_url": "https://merchant.example/payment/failure",
"customer": {
"email": "[email protected]",
"phone": "+37061234567"
}
}KEY="$(openssl rand -hex 16)" # store with the order before sending; reuse it after network errors
./payniko.sh POST '/api/payments/hosted' '{
"merchant_order_id": "ORDER-2026-001",
"amount": "100.00",
"currency": "USD",
"webhook_url": "https://merchant.example/webhooks/payments",
"success_url": "https://merchant.example/payment/success",
"fail_url": "https://merchant.example/payment/failure",
"customer": {
"email": "[email protected]",
"phone": "+37061234567"
}
}' "$KEY"import {api, randomUUID} from './payniko.mjs';
const key = randomUUID(); // Store this key with the order before sending; reuse it after network errors.
const payment = await api('POST', '/api/payments/hosted', {
"merchant_order_id": "ORDER-2026-001",
"amount": "100.00",
"currency": "USD",
"webhook_url": "https://merchant.example/webhooks/payments",
"success_url": "https://merchant.example/payment/success",
"fail_url": "https://merchant.example/payment/failure",
"customer": {
"email": "[email protected]",
"phone": "+37061234567"
}
}, key);
console.log(payment);<?php
require __DIR__ . '/payniko.php';
$key = bin2hex(random_bytes(16)); // store with the order; reuse it after network errors
$payment = payniko_api('POST', '/api/payments/hosted', [
"merchant_order_id" => 'ORDER-2026-001',
"amount" => '100.00',
"currency" => 'USD',
"webhook_url" => 'https://merchant.example/webhooks/payments',
"success_url" => 'https://merchant.example/payment/success',
"fail_url" => 'https://merchant.example/payment/failure',
"customer" => [
"email" => '[email protected]',
"phone" => '+37061234567',
],
], $key);
print_r($payment);from payniko import api
import uuid
key = str(uuid.uuid4()) # store with the order; reuse it after network errors
payment = api("POST", "/api/payments/hosted", {
"merchant_order_id": "ORDER-2026-001",
"amount": "100.00",
"currency": "USD",
"webhook_url": "https://merchant.example/webhooks/payments",
"success_url": "https://merchant.example/payment/success",
"fail_url": "https://merchant.example/payment/failure",
"customer": {
"email": "[email protected]",
"phone": "+37061234567"
}
}, key)
print(payment)Yanıt · 201
status: requires_action ve next_action.url içeren { "data": Payment } nesnesini döndürür.
Yanıt · Örnek
{
"data": {
"payment_id": "LUVEI-PAYN-123456",
"merchant_order_id": "ORDER-2026-001",
"flow": "hosted",
"status": "requires_action",
"amount": "100.00",
"currency": "USD",
"environment": "sandbox",
"next_action": {
"type": "redirect",
"url": "https://payniko.com/l/example-checkout",
"expires_at": "2026-11-02T12:00:00.000Z"
},
"card": null,
"failure": null,
"created_at": "2026-11-01T12:00:00.000Z",
"expires_at": "2026-11-02T12:00:00.000Z",
"completed_at": null
}
}Diğer yanıtlar
200: aynı anahtar ve istek gövdesi yeniden gönderildi. İlk ödeme döndürülür; yeni ödeme oluşturulmaz.4099000010: bu anahtar daha önce farklı bir istek gövdesiyle kullanılmış.4099000039: bu anahtarla gönderilen ilk istek hâlâ işleniyor. Kısa bir bekleme sonrası aynı isteği yeniden gönderin.4099000007: bumerchant_order_idiçin zaten bir ödeme mevcut.4229000005: tutar, hesabınızın tutar sınırlarının dışında; izin verilen aralıklimitsalanında yer alır.4221000001veerrorsiçindecustomer,customer.emailveyacustomer.phone: iletişim bilgileri eksik veya geçersiz.4221000001,1000020,1000021,9000008,9000038: bir alan geçersiz; ayrıntılarerrorsveintegration.violationsalanlarında yer alır.
HTTP 422 · 9000005
{
"type": "https://payniko.com/problems/9000005",
"title": "Invalid amount",
"status": 422,
"detail": "The amount is outside the account limits.",
"code": "9000005",
"correlation_id": "6d1f0c2e-8a4b-4c7d-9e21-3f5a7b9c1d20",
"limits": {
"currency_code": "USD",
"min_amount": "25.00",
"max_amount": null
}
}Tutar sınırları, tutarınız sistemin ana para birimine (limits.currency_code) çevrildikten sonra bu para biriminde değerlendirilir. max_amount: null değeri üst sınır olmadığını belirtir. Örnekteki sınır değerleri yalnızca açıklama amaçlıdır.