"error_code":400 Bad Request: STARS_INVOICE_INVALID
vicabert091 opened this issue · 1 comments
vicabert091 commented
func TestStar(t *testing.T) {
price := make([]tgbotapi.LabeledPrice, 0)
price = []tgbotapi.LabeledPrice{
tgbotapi.LabeledPrice{
Label: "XTR",
Amount: 1,
},
}
invoice := tgbotapi.NewInvoice(ChatID, "star pay", "start", "v-1",
"", "uZzZW3MS1XcCnEyrbBvsFRE8m96dqzQL",
"XTR", price)
api, err := tgbotapi.NewBotAPI(token)
if err != nil {
t.Fatal(err)
}
api.Debug = true
invoice.MaxTipAmount = 500
invoice.SuggestedTipAmounts = []int{100, 200, 300}
send, err := api.Send(invoice)
if err != nil {
t.Fatal(err)
}
fmt.Println(send)
}
err: Endpoint: sendInvoice, response: {"ok":false,"error_code":400,"description":"Bad Request: STARS_INVOICE_INVALID"}
star_test.go:36: Bad Request: STARS_INVOICE_INVALID
dengaletin commented
func TestStar(cmd BuyCommand) {
price := []tg.LabeledPrice{
{
Label: "XTR",
Amount: 1,
},
}
invoice := tg.NewInvoice(
cmd.Update.Message.Chat.ID,
"Star Pay",
"Purchase Stars",
"test",
"",
"start_param_unique_v1",
"XTR",
price,
)
invoice.SuggestedTipAmounts = []int{}
bot := utils.GetBot()
sentInvoice, err := bot.Send(invoice)
if err != nil {
log.Printf("Error sending invoice: %v", err)
return
}
fmt.Println("Invoice sent successfully:", sentInvoice)
}