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

pre_checkout_query & successful_payment doesn't work #1153

Open
justmavi opened this issue Oct 9, 2023 · 1 comment
Open

pre_checkout_query & successful_payment doesn't work #1153

justmavi opened this issue Oct 9, 2023 · 1 comment

Comments

@justmavi
Copy link

justmavi commented Oct 9, 2023

Hey m8s.

@Scene(SceneNames.PAYMENT_SCENE)
export class PaymentScene {
  @On('pre_checkout_query')
  public async onPreCheckout(@Ctx() ctx: Context) {
    console.log('pre checkout query', ctx);
    await ctx.answerPreCheckoutQuery(true);
  }

  @On('successful_payment')
  public onSuccessfulPayment(@Ctx() ctx: Context) {
    console.log('success', ctx);
  }
}

This code doesn't work.
But when I use bot.on, everything works:

@Scene(SceneNames.PAYMENT_SCENE)
export class PaymentScene {
  constructor(@InjectBot() bot: Telegraf<Context>) {
    super();

    bot.on('pre_checkout_query', this.onPreCheckout.bind(this));
    bot.on('successful_payment', this.onSuccessfulPayment.bind(this));
  }
  public async onPreCheckout(ctx: Context) {
    console.log('pre checkout query', ctx);
    await ctx.answerPreCheckoutQuery(true);
  }

  public onSuccessfulPayment(ctx: Context) {
    console.log('success', ctx);
  }
}
@justmavi justmavi changed the title pre_checkout_query & successful_payment not working pre_checkout_query & successful_payment doesn't work Oct 9, 2023
@mr-kenikh
Copy link

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

2 participants