Skip to content
Discussion options

You must be logged in to vote

LabeledPrice — обычная структура без конструктора с двумя аргументами, поэтому make_shared<LabeledPrice>("Item Price", 1000) не скомпилируется. Заполните поля явно:

auto price = std::make_shared<TgBot::LabeledPrice>();
price->label = "Item Price";
price->amount = 1000; // 10.00 RUB: сумма указывается в копейках

TgBot::SendInvoiceArgs invoice;
invoice.chatId = query->message->chat->id;
invoice.title = "Product Title";
invoice.description = "Product Description";
invoice.payload = "Payload";
invoice.providerToken = "PROVIDER_TOKEN";
invoice.currency = "RUB";
invoice.prices = {price};

bot.getApi().sendInvoice(invoice);

Для Telegram Stars используйте currency = "XTR", пустой providerToken и…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by reo7sp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants