FILE / ScuroNeko/Laniakea

tgapi/payments_types.go

Исходный файл и его история в репозитории.
FILE dev
Files
Laniakea/tgapi/payments_types.go
ScuroNeko 29b208eeec
Golang lint / lint (push) Successful in 11m32s
(new): v1.2 release
2026-08-19 14:58:25 +03:00

170 lines
7.4 KiB
Go

package tgapi
// LabeledPrice represents a price portion.
// Since: Bot API 3.0
// See https://core.telegram.org/bots/api#labeledprice
type LabeledPrice struct {
// Label Portion label
Label string `json:"label"`
// Amount Price of the product in the smallest units of the currency (integer, not float/double). For
// example, for a price of US$ 1.45 pass amount = 145. See the exp parameter in currencies.json, it shows
// the number of digits past the decimal point for each currency (2 for the majority of currencies).
Amount int `json:"amount"`
}
// Invoice contains basic information about an invoice.
// Since: Bot API 3.0
type Invoice struct {
// Title Product name
Title string `json:"title"`
// Description Product description
Description string `json:"description"`
// StartParameter Unique bot deep-linking parameter that can be used to generate this invoice
StartParameter string `json:"start_parameter"`
// Currency Three-letter ISO 4217 currency code, or “XTR” for payments in Telegram Stars
Currency string `json:"currency"`
// TotalAmount Total price in the smallest units of the currency (integer, not float/double). For example,
// for a price of US$ 1.45 pass amount = 145. See the exp parameter in currencies.json, it shows the number
// of digits past the decimal point for each currency (2 for the majority of currencies).
TotalAmount int `json:"total_amount"`
}
// ShippingQuery represents an incoming shipping query.
// Since: Bot API 3.0
// See https://core.telegram.org/bots/api#shippingquery
type ShippingQuery struct {
// ID Unique query identifier
ID string `json:"id"`
// From User who sent the query
From User `json:"from"`
// InvoicePayload Bot-specified invoice payload
InvoicePayload string `json:"invoice_payload"`
// ShippingAddress User specified shipping address
ShippingAddress ShippingAddress `json:"shipping_address"`
}
// ShippingAddress represents a shipping address.
// Since: Bot API 3.0
// See https://core.telegram.org/bots/api#shippingaddress
type ShippingAddress struct {
// CountryCode Two-letter ISO 3166-1 alpha-2 country code
CountryCode string `json:"country_code"`
// State State, if applicable
State string `json:"state"`
// City City
City string `json:"city"`
// StreetLine1 First line for the address
StreetLine1 string `json:"street_line1"`
// StreetLine2 Second line for the address
StreetLine2 string `json:"street_line2"`
// PostCode Address post code
PostCode string `json:"post_code"`
}
// OrderInfo represents information about an order.
// Since: Bot API 3.0
// See https://core.telegram.org/bots/api#orderinfo
type OrderInfo struct {
// Name Optional. User name
Name string `json:"name"`
// PhoneNumber Optional. User's phone number
PhoneNumber string `json:"phone_number"`
// Email Optional. User email
Email string `json:"email"`
// ShippingAddress Optional. User shipping address
ShippingAddress ShippingAddress `json:"shipping_address"`
}
// PreCheckoutQuery represents an incoming pre-checkout query.
// Since: Bot API 3.0
// See https://core.telegram.org/bots/api#precheckoutquery
type PreCheckoutQuery struct {
// ID Unique query identifier
ID string `json:"id"`
// From User who sent the query
From User `json:"from"`
// Currency Three-letter ISO 4217 currency code, or “XTR” for payments in Telegram Stars
Currency string `json:"currency"`
// TotalAmount Total price in the smallest units of the currency (integer, not float/double). For example,
// for a price of US$ 1.45 pass amount = 145. See the exp parameter in currencies.json, it shows the number
// of digits past the decimal point for each currency (2 for the majority of currencies).
TotalAmount int `json:"total_amount"`
// InvoicePayload Bot-specified invoice payload
InvoicePayload string `json:"invoice_payload"`
// ShippingOptionID Optional. Identifier of the shipping option chosen by the user
ShippingOptionID string `json:"shipping_option_id"`
// OrderInfo Optional. Order information provided by the user
OrderInfo *OrderInfo `json:"order_info,omitempty"`
}
// PaidMediaPurchased represents a purchased paid media.
// Since: Bot API 7.10
// See https://core.telegram.org/bots/api#paidmediapurchased
type PaidMediaPurchased struct {
// From User who purchased the media
From User `json:"from"`
// PaidMediaPayload Bot-specified paid media payload
PaidMediaPayload string `json:"paid_media_payload"`
}
// ShippingOption represents one shipping option.
// Since: Bot API 3.0
// See https://core.telegram.org/bots/api#shippingoption
type ShippingOption struct {
// ID Shipping option identifier
ID string `json:"id"`
// Title Option title
Title string `json:"title"`
// Prices List of price portions
Prices []LabeledPrice `json:"prices"`
}
// SuccessfulPayment contains basic information about a successful payment.
// Since: Bot API 3.0
type SuccessfulPayment struct {
// Currency Three-letter ISO 4217 currency code, or “XTR” for payments in Telegram Stars
Currency string `json:"currency"`
// TotalAmount Total price in the smallest units of the currency (integer, not float/double). For example,
// for a price of US$ 1.45 pass amount = 145. See the exp parameter in currencies.json, it shows the number
// of digits past the decimal point for each currency (2 for the majority of currencies).
TotalAmount int `json:"total_amount"`
// InvoicePayload Bot-specified invoice payload
InvoicePayload string `json:"invoice_payload"`
// SubscriptionExpirationDate Optional. Expiration date of the subscription, in Unix time; for recurring
// payments only
SubscriptionExpirationDate int `json:"subscription_expiration_date,omitempty"` // Since: Bot API 8.0
// IsRecurring Optional. True, if the payment is a recurring payment for a subscription
IsRecurring bool `json:"is_recurring,omitempty"` // Since: Bot API 8.0
// IsFirstRecurring Optional. True, if the payment is the first payment for a subscription
IsFirstRecurring bool `json:"is_first_recurring,omitempty"` // Since: Bot API 8.0
// ShippingOptionID Optional. Identifier of the shipping option chosen by the user
ShippingOptionID string `json:"shipping_option_id,omitempty"`
// OrderInfo Optional. Order information provided by the user
OrderInfo *OrderInfo `json:"order_info,omitempty"`
// TelegramPaymentChargeID Telegram payment identifier
TelegramPaymentChargeID string `json:"telegram_payment_charge_id"`
// ProviderPaymentChargeID Provider payment identifier
ProviderPaymentChargeID string `json:"provider_payment_charge_id"`
}
// RefundedPayment contains basic information about a refunded payment.
// Since: Bot API 7.7
type RefundedPayment struct {
// Currency Three-letter ISO 4217 currency code, or “XTR” for payments in Telegram Stars. Currently,
// always “XTR”.
Currency string `json:"currency"`
// TotalAmount Total refunded price in the smallest units of the currency (integer, not float/double). For
// example, for a price of US$ 1.45, total_amount = 145. See the exp parameter in currencies.json, it shows
// the number of digits past the decimal point for each currency (2 for the majority of currencies).
TotalAmount int `json:"total_amount"`
// InvoicePayload Bot-specified invoice payload
InvoicePayload string `json:"invoice_payload"`
// TelegramPaymentChargeID Telegram payment identifier
TelegramPaymentChargeID string `json:"telegram_payment_charge_id"`
// ProviderPaymentChargeID Optional. Provider payment identifier
ProviderPaymentChargeID string `json:"provider_payment_charge_id,omitempty"`
}