【问题标题】:How to get response after the UPI payment is done in flutter/dart在flutter/dart中完成UPI支付后如何得到响应
【发布时间】:2021-08-14 10:03:06
【问题描述】:

有人可以帮我在 UPI 交易完成后如何获取响应。我在 Stack Overflow 中使用了这个帮助,但它不起作用:“https://stackoverflow.com/questions/48097332/how-can-we-get-response-from-an-app-which-was-launched-by -另一个应用程序”。

就我而言,当我合并它时,它会说 MissingPluginException(未找到实现方法)。

class _DisplayCartItemState extends State<DisplayCartItem> {
  static const platform = const MethodChannel('upi/tez');
  Uri uri;

  @override
  void initState() {
    super.initState();
    uri = Uri.parse('upi://pay?pa=*****@okhdfcbank&pn=Test App&tn=Payment Done through Foodie App&cu=INR&am=1');
  }

_startPaymentTransaction(BuildContext context) async {
        if (await canLaunch(uri.toString())) {
          try {
            final String result = await platform.invokeMethod('launchUpi', <String, dynamic>{"url": uri.toString()});
            ScaffoldMessenger.of(context).showSnackBar(SnackBar(
              content: Text(result),
            ));
            print(result);
          }catch(e){
            ScaffoldMessenger.of(context).showSnackBar(SnackBar(
              content: Text(e.toString()),
            ));
          }
        } else {
          ScaffoldMessenger.of(context).showSnackBar(SnackBar(
            content: Text("Could not launch the UPI App"),
          ));
        }
      }
}

谢谢

【问题讨论】:

  • 有人可以帮忙吗?

标签: flutter dart


【解决方案1】:
void _launchURL() async {
    String _url='upi://pay?pa=dinesh@dlanzer&pn=Dinesh&am=1&tn=Test Payment&cu=INR';
    var result = await launch(_url);
     debugPrint(result.toString());
     if (result ==true) {
       print("Done");
     } else if (result ==false){
       print("Fail");
     }
  }

试试这个代码

我使用 url_launcher 插件来打开 UPI 应用程序。

深度链接网址'upi://pay?pa=dinesh@dlanzer&amp;pn=Dinesh&amp;am=1&amp;tn=Test Payment&amp;cu=INR',

upi 显示您手机中的 UPI 应用列表。

pay 被重定向到支付页面。

pa您在此处提及upi地址(请注册企业upi帐户并在此处提及)。

am金额在这里输入。

tn只是通过按摩。

cu 提及您要付款的币种

【讨论】:

  • 请提供解释。见How to answer
  • 我使用 url_launcher 插件来打开 UPI 应用程序。 Deeplink url 'upi://pay?pa=dinesh@dlanzer&pn=Dinesh&am=1&tn=Test Payment&cu=INR', upi 显示您手机中的 UPI 应用程序列表。 pay 被重定向到支付页面。 pa你在这里提到upi地址(请注册企业upi帐户并在此提及)。 am 金额在这里输入。 tn 只是通过按摩。 cu提及您要付款的币种
  • 好的,那么您可以编辑您的答案而不是评论。
  • 好的兄弟,我会编辑我的答案
猜你喜欢
  • 2017-11-11
  • 2017-08-04
  • 1970-01-01
  • 2013-03-26
  • 2021-06-08
  • 2018-02-21
  • 2020-09-14
  • 2020-06-28
  • 2020-10-27
相关资源
最近更新 更多