openInvoice method

  1. @override
void openInvoice(
  1. String url, [
  2. void onInvoiceStatus(
    1. InvoiceStatus status
    )?
])
override

Bot API 6.1+ A method that opens an invoice using the link url. The Mini App will receive the event invoiceClosed when the invoice is closed. If an optional callback parameter was passed, the callback function will be called and the invoice status will be passed as the first argument.

Implementation

@override
void openInvoice(String url, [void Function(InvoiceStatus status)? onInvoiceStatus]) => Telegram.WebApp.openInvoice(
      url,
      onInvoiceStatus != null
          ? ((String status) => onInvoiceStatus.call(InvoiceStatus.values.firstWhere((e) => e.name == status))).toJS
          : null,
    );