Telegram Bot API
🌐 한국어

sendInvoice

카테고리: 결제 · Bot API 10.3 · 공식 문서

결제용 인보이스를 전송합니다.

반환값: 성공 시 반환값: Message.

매개변수

매개변수타입필수설명
chat_idInteger or String예채팅 ID 또는 @username
message_thread_idInteger선택포럼 토픽 ID
direct_messages_topic_idInteger선택다이렉트 메시지 토픽 ID (Bot API 10.0)
titleString예상품명 (1-32)
descriptionString예상품 설명 (1-255)
payloadString예페이로드
provider_tokenString선택결제 제공자 토큰
currencyString예통화 (Stars는 XTR)
pricesArray of LabeledPrice예LabeledPrice JSON 배열
max_tip_amountInteger선택최대 팁 금액
suggested_tip_amountsArray of Integer선택추천 팁 금액 JSON 배열
start_parameterString선택결제용 딥 링크
provider_dataString선택결제 제공자용 JSON 데이터
photo_urlString선택상품 사진 URL
photo_sizeInteger선택사진 크기
photo_widthInteger선택사진 너비
photo_heightInteger선택사진 높이
need_nameBoolean선택사용자 이름 요청
need_phone_numberBoolean선택전화번호 요청
need_emailBoolean선택이메일 요청
need_shipping_addressBoolean선택배송 주소 요청
send_phone_number_to_providerBoolean선택결제 제공자에게 전화번호 전송
send_email_to_providerBoolean선택결제 제공자에게 이메일 전송
is_flexibleBoolean선택가변 배송비
disable_notificationBoolean선택알림 없이 전송
protect_contentBoolean선택콘텐츠 보호
allow_paid_broadcastBoolean선택유료 브로드캐스트 허용
message_effect_idString선택메시지 효과 ID
suggested_post_parametersSuggestedPostParameters선택SuggestedPostParameters JSON 객체 (채널용)
reply_parametersReplyParameters선택ReplyParameters JSON 객체
reply_markupInlineKeyboardMarkup선택InlineKeyboardMarkup JSON 객체

매개변수 설명은 핵심만 간추린 요약입니다. 전체 설명은 공식 문서에서 확인할 수 있습니다.

요청 예제

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());

단계별 가이드: 텔레그램 봇 만들기: @BotFather로 생성하고 첫 메시지 보내기