GuardianVPN icon indicating copy to clipboard operation
GuardianVPN copied to clipboard

Error when creating an invoice (selecting a subscription period)

Open rooffall opened this issue 2 years ago • 5 comments

When choosing a payment term, an error.

ERROR:telegram.ext._application:No error handlers are registered, logging exception.
Traceback (most recent call last):
  File "/root/venv/env/lib/python3.11/site-packages/telegram/ext/_application.py", line 1104, in process_update
    await coroutine
  File "/root/venv/env/lib/python3.11/site-packages/telegram/ext/_handler.py", line 141, in handle_update
    return await self.callback(update, context)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/dev/GuardianVPN-main/bot.py", line 155, in select_product
    await context.bot.send_invoice(
  File "/root/venv/env/lib/python3.11/site-packages/telegram/ext/_extbot.py", line 2455, in send_invoice
    return await super().send_invoice(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/venv/env/lib/python3.11/site-packages/telegram/_bot.py", line 331, in decorator
    result = await func(*args, **kwargs)  # skipcq: PYL-E1102
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/venv/env/lib/python3.11/site-packages/telegram/_bot.py", line 4280, in send_invoice
    return await self._send_message(
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/venv/env/lib/python3.11/site-packages/telegram/ext/_extbot.py", line 488, in _send_message
    result = await super()._send_message(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/venv/env/lib/python3.11/site-packages/telegram/_bot.py", line 512, in _send_message
    result = await self._post(
             ^^^^^^^^^^^^^^^^^
  File "/root/venv/env/lib/python3.11/site-packages/telegram/_bot.py", line 419, in _post
    return await self._do_post(
           ^^^^^^^^^^^^^^^^^^^^
  File "/root/venv/env/lib/python3.11/site-packages/telegram/ext/_extbot.py", line 306, in _do_post
    return await super()._do_post(
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/venv/env/lib/python3.11/site-packages/telegram/_bot.py", line 450, in _do_post
    return await request.post(
           ^^^^^^^^^^^^^^^^^^^
  File "/root/venv/env/lib/python3.11/site-packages/telegram/request/_baserequest.py", line 165, in post
    result = await self._request_wrapper(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/venv/env/lib/python3.11/site-packages/telegram/request/_baserequest.py", line 328, in _request_wrapper
    raise BadRequest(message)
telegram.error.BadRequest: Currency_invalid

rooffall avatar Oct 13 '23 00:10 rooffall

It seems you're encountering a "Currency_invalid" error. This error is raised when you provide an invalid or unsupported currency for an invoice. To resolve this issue, ensure that you are using a valid currency code and that the payment amount exceeds the minimum required by your payment provider of choice.

mearashadowfax avatar Oct 13 '23 01:10 mearashadowfax

Ooh, you're right I use the payment method for Russia, but have not changed the currency. The question now is different, how to correctly transfer to RUB? When changing the currency normally, I get telegram.error.BadRequest: Currency_total_amount_invalid

rooffall avatar Oct 13 '23 01:10 rooffall

When changing the currency normally, I get telegram.error.BadRequest: Currency_total_amount_invalid

It's the same. This time you have to make sure that the payment amount exceeds the minimum required by your payment provider of choice. If we are talking about rubles, the value should be specified in kopecks. For instance, 500 rubles should be represented as 500 * 100 or 50,000 kopecks. In the case of rubles, the minimum amount right now would be 100 rubles, which should be specified as 100 * 100 in your code.

mearashadowfax avatar Oct 13 '23 01:10 mearashadowfax

Oh, it works. Now it is clear. Thank you very much and good luck!

rooffall avatar Oct 13 '23 02:10 rooffall

Thank you for your contribution to this discussion. We've decided to keep this issue open for reference, as the conversation here contains useful information for anyone who may encounter a similar issue in the future.

To maintain clarity, we won't be closing this issue. Instead, we're locking it to prevent further comments or changes. This way, the discussion remains accessible, and the resolution is clear.

mearashadowfax avatar Oct 13 '23 02:10 mearashadowfax