Closed KoldaN1 closed 1 year ago
Hi!
First of all, I created the invoice(async):
await bot.sendInvoice( chatId, title, "InvoiceDescription", ${chatId}_${Number(new Date())}, process.env.LIQPAY_TEST, currency, [ { label: title, amount: amount, }, ] );
After I am listening pre_checkout_query and getting invoice id and putting it inside answerPreCheckoutQuery:
bot.on("pre_checkout_query", (msg) => { bot.answerPreCheckoutQuery(msg.id, true); });
And finally, I am listening successful_payment and getting there all data from payment, for example:
bot.on("successful_payment", async (msg) => { const receiptId = msg.successful_payment.provider_payment_charge_id; *you can do smth with this receiptId });
Hi!
First of all, I created the invoice(async):
await bot.sendInvoice( chatId, title, "InvoiceDescription", ${chatId}_${Number(new Date())}, process.env.LIQPAY_TEST, currency, [ { label: title, amount: amount, }, ] );
After I am listening pre_checkout_query and getting invoice id and putting it inside answerPreCheckoutQuery:
bot.on("pre_checkout_query", (msg) => { bot.answerPreCheckoutQuery(msg.id, true); });
And finally, I am listening successful_payment and getting there all data from payment, for example:
bot.on("successful_payment", async (msg) => { const receiptId = msg.successful_payment.provider_payment_charge_id; *you can do smth with this receiptId });
I am trying to do the same with Stripe test secret key, but its not working.
Hello everyone. I need an example of working with payments in a bot. I've seen an example here, but it's 2018, and therefore, most likely, is no longer relevant, and therefore I need to know how to work with them now. I can send the payment, but I have no idea how to process and receive it. I will be grateful for your help