Creating INVOICE in Telegram bot return's error
Asked Answered
L

1

7

I try to integrate payments to my telegram bot. I usen telegraf library for working. So I create an invoice

const invoice = {
    provider_token: payment_tocken,
    start_parameter: 'online_conslutation',
    title: 'Онлайн консультация Айболит',
    description: 'Проведение Онлайн консультации с врачем. Стоимость 1000 рублей. Длительность 1час',
    currency: 'RUB',
    photo_url: 'https://encrypted-tbn0.gstatic.com/images?q=tbn%3AANd9GcThWVMksAXRtRQJn3oHFWyz9FMusRty4pQX5Iobe8OfMEJmRzpD&usqp=CAU',
    need_shipping_address: false,
    is_flexible: true,
    prices: [
        { label: 'Онлайн консультация', amount: 100 }
    ],
    payload: {}

};

And here I send it

    const stepHandlerBuy = new Composer()
    stepHandlerBuy.action('buy', (ctx) => {
        ctx.replyWithInvoice(invoice);
        return ctx.wizard.next();
    })

But it always return my an error

(node:24476) UnhandledPromiseRejectionWarning: Error: 400: Bad Request: 

    CURRENCY_TOTAL_AMOUNT_INVALID
        at /Users/nabiullinanton/Documents/UnitBean/NodeJSProjects/VetClinicTelegramFront/node_modules/telegraf/core/network/client.js:281:17

As I see I have problem with total amount? but how can I fix it?

Lipps answered 16/4, 2020 at 14:49 Comment(2)
try "100",100.00 or othersMicrocircuit
have already tried - the same errorLipps
L
9

I found an error. API use price in kopeika (like cents in usd). So I should type

{ label: 'Онлайн консультация', amount: 100*100 }//100 kopoeikas*100 = 100 rubles
Lipps answered 16/4, 2020 at 16:45 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.