我在我的 flutter 应用程序中使用 Paytm all in one sdk。它抛出 PlatformException 错误

I'm using the Paytm all in one sdk in my flutter application. It's throwing PlatformException error

在我的应用程序的页面中,我正在调用 startTransaction() 插件方法,并按照 paytm 文档中的方式存储响应。收到回复后,我想 return 上一页的状态是成功还是失败。所以在 init() 函数中我调用了另一个异步方法来启动事务并检查响应。

PlatformException (0, Unknown error, {response : { response of transaction})

class StartTransaction extends StatefulWidget {
  int orderId;
  double totalAmount;
  PaymentPayload paymentPayload;
  bool success;
  StartTransaction({this.orderId,this.totalAmount});
  @override
  _StartTransactionState createState() => _StartTransactionState();
}

class _StartTransactionState extends State<StartTransaction> {

@override
  void initState() {
    super.initState();
    initiateTransaction();
  }

  Future initiateTransaction() async {
    if(widget.success == null){
      widget.paymentPayload = await createPaymentGateway(
          widget.orderId,
          userBloc.userData.username,
        widget.totalAmount.toStringAsFixed(2),
          context);
      var pgResp = AllInOneSdk.startTransaction(
          widget.paymentPayload.mid,
          widget.orderId.toString(),
          widget.totalAmount.toStringAsFixed(2),
          widget.paymentPayload.txnToken,
          widget.paymentPayload.callbackUrl,
          true,
          false);
      pgResp.then((value) {
        print(value);
        setState(() {
          widget.success = value['RESPCODE'] == 01;
        });
      }).catchError((onError) {
        setState(() {
          widget.success = false;
        });
      });
    }
  }
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: SafeArea(
        child: FutureBuilder(
            builder: (context, snapshot) {
              if(widget.success == true) {
                print('Payment successful');
                Navigator.pop(context,true);
              } else if(widget.success == false) {
                print('Payment unsuccessful');
                Navigator.pop(context,false);
              }
              return Center(
                child: Column(
                  mainAxisAlignment: MainAxisAlignment.center,
                  crossAxisAlignment: CrossAxisAlignment.center,
                  children: [
                    Text('We are processing your transaction', style: TextStyle(fontSize: 36),),
                    CircularProgressIndicator(),
                  ],
                ),
              );
            }
        ),
      ),
    );
  }

  
}```

您需要根据交易中使用的订单id和MID调用交易状态API。无需再次调用starttransaction方法

您应该使用交易状态 API 通过服务器端请求验证交易响应。此 API 要求在请求和响应中使用校验和哈希。您必须使用您的数据验证订单 ID 和金额。在所有情况下,该状态都应视为交易的最终状态。

在这种情况下您需要使用我们的静态回调url

暂存环境:“https://securegw-stage.paytm.in/theia/paytmCallback?ORDER_ID=” 生产环境:“https://securegw.paytm.in/theia/paytmCallback?ORDER_ID=