Telegram Bot API
🌐 Türkçe

sendInvoice

Kategori: Ödemeler · Bot API 10.3 · Resmi dokümantasyon

Ödeme için fatura gönderir.

Dönüş değeri: Başarılı olduğunda Message döndürür.

Parametreler

ParametreTürZorunluAçıklama
chat_idInteger or StringEvetSohbet ID'si veya @username
message_thread_idIntegerİsteğe bağlıForum konusu ID'si
direct_messages_topic_idIntegerİsteğe bağlıDoğrudan mesajlar konusu ID'si (Bot API 10.0)
titleStringEvetÜrün adı (1-32)
descriptionStringEvetÜrün açıklaması (1-255)
payloadStringEvetPayload
provider_tokenStringİsteğe bağlıÖdeme sağlayıcısı token'ı
currencyStringEvetPara birimi (Stars için XTR)
pricesArray of LabeledPriceEvetJSON LabeledPrice dizisi
max_tip_amountIntegerİsteğe bağlıMaksimum bahşiş tutarı
suggested_tip_amountsArray of Integerİsteğe bağlıÖnerilen bahşiş tutarlarının JSON dizisi
start_parameterStringİsteğe bağlıÖdeme için deep link
provider_dataStringİsteğe bağlıSağlayıcı için JSON verisi
photo_urlStringİsteğe bağlıÜrün fotoğrafı URL'si
photo_sizeIntegerİsteğe bağlıFotoğraf boyutu
photo_widthIntegerİsteğe bağlıFotoğraf genişliği
photo_heightIntegerİsteğe bağlıFotoğraf yüksekliği
need_nameBooleanİsteğe bağlıKullanıcının adını iste
need_phone_numberBooleanİsteğe bağlıTelefon numarasını iste
need_emailBooleanİsteğe bağlıE-posta adresini iste
need_shipping_addressBooleanİsteğe bağlıTeslimat adresini iste
send_phone_number_to_providerBooleanİsteğe bağlıTelefon numarasını sağlayıcıya gönder
send_email_to_providerBooleanİsteğe bağlıE-posta adresini sağlayıcıya gönder
is_flexibleBooleanİsteğe bağlıEsnek teslimat fiyatı
disable_notificationBooleanİsteğe bağlıSessiz gönder
protect_contentBooleanİsteğe bağlıİçeriği koru
allow_paid_broadcastBooleanİsteğe bağlıÜcretli yayına izin ver
message_effect_idStringİsteğe bağlıMesaj efekti ID'si
suggested_post_parametersSuggestedPostParametersİsteğe bağlıJSON SuggestedPostParameters nesnesi (kanallar için)
reply_parametersReplyParametersİsteğe bağlıJSON ReplyParameters nesnesi
reply_markupInlineKeyboardMarkupİsteğe bağlıJSON: InlineKeyboardMarkup

Parametre açıklamaları kısa özetlerdir; tam metin için resmi dokümantasyona bakın.

Örnek istek

curl

curl -s -X POST "https://api.telegram.org/bot$TOKEN/sendInvoice" \
  -H "Content-Type: application/json" \
  -d '{
  "chat_id": 123456789,
  "title": "Example",
  "description": "Example item",
  "payload": "order-1",
  "currency": "XTR",
  "prices": [
    {
      "label": "Item",
      "amount": 100
    }
  ]
}'

Python

import requests

TOKEN = "123456789:AAEexampleTokenReplaceWithYours"
resp = requests.post(
    f"https://api.telegram.org/bot{TOKEN}/sendInvoice",
    json={
        "chat_id": 123456789,
        "title": "Example",
        "description": "Example item",
        "payload": "order-1",
        "currency": "XTR",
        "prices": [
            {
                "label": "Item",
                "amount": 100
            }
        ]
    },
    timeout=30,
)
print(resp.json())

JavaScript

const TOKEN = "123456789:AAEexampleTokenReplaceWithYours";
const res = await fetch(`https://api.telegram.org/bot${TOKEN}/sendInvoice`, {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    "chat_id": 123456789,
    "title": "Example",
    "description": "Example item",
    "payload": "order-1",
    "currency": "XTR",
    "prices": [
      {
        "label": "Item",
        "amount": 100
      }
    ]
  }),
});
console.log(await res.json());

Adım adım rehber: Telegram bot nasıl yapılır? BotFather ile adım adım bot oluşturma