【发布时间】: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"),
));
}
}
}
谢谢
【问题讨论】:
-
有人可以帮忙吗?