yagop / node-telegram-bot-api

Telegram Bot API for NodeJS
MIT License
8.31k stars 1.51k forks source link

Suggested Tip Amounts #970

Closed GlennNg closed 2 years ago

GlennNg commented 2 years ago

Question

Hello everyone, I am trying to include the "suggested_tip_amounts" under the options of sendInvoice. However, my max_tip_amount works, but not the "suggested_tip_amounts" appreciate if anyone could pin point my problem.

bot.onText(/\/supportRiders/, msg => {
    const chatId = msg.chat.id;
    const username = msg.from.username
    const timestamp = msg.date
    console.log(msg)
    bot.sendInvoice(chatId, "Thanks, @" + username + "!", timestamp,
    "STRIPE-KEY", null, "USD", 
    [{"label":"Here's a meal treat from @" + msg.from.username, "amount": 500}],
    {max_tip_amount: 5000, suggested_tip_amounts: [300, 500]}
    );
});
danielperez9430 commented 2 years ago

This problem is related that your array is not convert to a JSON string, for the moment you can do suggested_tip_amounts: JSON.stringify([300, 500]). But I think we need to fix it.

danielperez9430 commented 2 years ago

Fix on next release, not need to do a JSON.stringify() for suggested_tip_amounts