PayTR

API

Turkish virtual POS API with an iFrame payment page, installments and payouts

Fiyat
Fee per transaction
Erişim
Merchant ID, key and salt

Hakkında

PayTR is a licensed Turkish payment institution. Its iFrame API embeds a hosted card form with installments, and the Direct API takes cards on your own form, with card storage, payment links, refunds and marketplace transfers to sellers. Requests carry an HMAC token from your merchant key and salt.

Neler yapabilirsin

  • Embed a hosted card payment form with installments through the iFrame API
  • Charge stored cards again for recurring payments without asking for card details
  • Transfer each marketplace seller's share of an order to the seller's IBAN

Başlarken

  1. Apply as a PayTR merchant and upload your business documents
  2. Copy merchant_id, merchant_key and merchant_salt from the Merchant Panel
  3. Send test payments, then request live mode in the panel

Örnek kod

import base64, hashlib, hmac, json, requests

merchant_id, merchant_key, merchant_salt = 'XXXXXX', b'YYYYYYYYYYYYYY', b'ZZZZZZZZZZZZZZ'
basket = base64.b64encode(json.dumps([['Sample Product 1', '34.56', 1]]).encode()).decode()
# Token fields in the documented hash order; payment_amount is 34.56 TL x 100
params = {'merchant_id': merchant_id, 'user_ip': '85.34.78.112', 'merchant_oid': 'ORDER123',
          'email': 'buyer@example.com', 'payment_amount': '3456', 'user_basket': basket,
          'no_installment': '0', 'max_installment': '0', 'currency': 'TL', 'test_mode': '1'}
hash_str = ''.join(params.values())
params['paytr_token'] = base64.b64encode(
    hmac.new(merchant_key, hash_str.encode() + merchant_salt, hashlib.sha256).digest())
params.update({'user_name': 'John Doe', 'user_address': 'Istanbul', 'user_phone': '05555555555',
               'merchant_ok_url': 'https://example.com/ok', 'merchant_fail_url': 'https://example.com/fail'})
res = requests.post('https://www.paytr.com/odeme/api/get-token', params)
print(res.json())  # token for the iFrame at https://www.paytr.com/odeme/guvenli/<token>

Ayrıntılar

Barındırma
Hazır hizmet (bulut)
Kullanılabildiği yerler
Türkiye
MCP sunucusu
Yok
Entegrasyonlar
WooCommerce, Shopify, Wix

Görevler

Alternatifler

Aynı görevler için başka araçlar.

Son kontrol: .