Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CreateInvoiceLink query: [400] Bad Request: STARS_INVOICE_INVALID #1410

Open
omanhom opened this issue Aug 13, 2024 · 4 comments
Open

CreateInvoiceLink query: [400] Bad Request: STARS_INVOICE_INVALID #1410

omanhom opened this issue Aug 13, 2024 · 4 comments

Comments

@omanhom
Copy link

omanhom commented Aug 13, 2024

Describe the bug
org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException: Error executing org.telegram.telegrambots.meta.api.methods.invoices.CreateInvoiceLink query: [400] Bad Request: STARS_INVOICE_INVALID
at org.telegram.telegrambots.meta.api.methods.botapimethods.PartialBotApiMethod.deserializeResponseInternal(PartialBotApiMethod.java:61)
at org.telegram.telegrambots.meta.api.methods.botapimethods.PartialBotApiMethod.deserializeResponse(PartialBotApiMethod.java:41)
at org.telegram.telegrambots.meta.api.methods.invoices.CreateInvoiceLink.deserializeResponse(CreateInvoiceLink.java:238)
at org.telegram.telegrambots.meta.api.methods.invoices.CreateInvoiceLink.deserializeResponse(CreateInvoiceLink.java:29)
at org.telegram.telegrambots.client.okhttp.OkHttpFutureCallback.onResponse(OkHttpFutureCallback.java:35)

To Reproduce
OkHttpTelegramClient telegramClient = new OkHttpTelegramClient("your token");
CreateInvoiceLinkBuilder createInvoiceLinkBuilder = CreateInvoiceLink.builder();
createInvoiceLinkBuilder.title("recharge stars");
createInvoiceLinkBuilder.description("recharge stars desc");
createInvoiceLinkBuilder.payload("{}");
createInvoiceLinkBuilder.currency("XTR");
createInvoiceLinkBuilder.providerToken("");
Collection prices = Lists.newArrayList(new LabeledPrice("价格1", 1),new LabeledPrice("价格2", 2));
createInvoiceLinkBuilder.prices(prices);
CreateInvoiceLink createInvoiceLink = createInvoiceLinkBuilder.build();
String url = telegramClient.execute(createInvoiceLink);

@rubenlagus
Copy link
Owner

what if you try to use a different payload? something like "1234"?

Basically that error is the server saying that something in the message message is wrong

@lll-Death-lll
Copy link

Same issue, with different library. Doesn't work with any payload that I try to set. Guess something is wrong on the telegram level

@omanhom
Copy link
Author

omanhom commented Aug 27, 2024

XTR price must one item

@Sheharyar566
Copy link

Providing a single item to prices fixed the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants