Flutter I';我在颤振应用程序中使用Paytm多功能一体sdk。它';s引发平台异常错误

Flutter I';我在颤振应用程序中使用Paytm多功能一体sdk。它';s引发平台异常错误,flutter,exception,hybrid-mobile-app,platform,paytm,Flutter,Exception,Hybrid Mobile App,Platform,Paytm,在我的应用程序中,我在一个页面中调用startTransaction()插件方法,并将响应存储在paytm文档中。在收到响应时,我想将状态返回到上一页,无论是成功还是失败。因此,在init()函数中,我调用另一个异步方法来启动Transaction并检查响应 PlatformException(0,未知错误,{响应:{事务的响应}) class StartTransaction扩展StatefulWidget{ int-orderId; 双倍总额; payment有效载荷payment有效载荷;

在我的应用程序中,我在一个页面中调用startTransaction()插件方法,并将响应存储在paytm文档中。在收到响应时,我想将状态返回到上一页,无论是成功还是失败。因此,在init()函数中,我调用另一个异步方法来启动Transaction并检查响应

PlatformException(0,未知错误,{响应:{事务的响应})

class StartTransaction扩展StatefulWidget{
int-orderId;
双倍总额;
payment有效载荷payment有效载荷;
成功;
StartTransaction({this.orderId,this.totalAmount});
@凌驾
_StartTransactionState createState()=>_StartTransactionState();
}
类_StartTransactionState扩展状态{
@凌驾
void initState(){
super.initState();
initiateTransaction();
}
Future initiateTransaction()异步{
if(widget.success==null){
widget.paymentPayload=等待createPaymentGateway(
widget.orderId,
userBloc.userData.username,
widget.totalAmount.ToStringGasFixed(2),
上下文);
var pgResp=AllInOneSdk.startTransaction(
widget.paymentPayload.mid,
widget.orderId.toString(),
widget.totalAmount.ToStringGasFixed(2),
widget.paymentPayload.txnToken,
widget.paymentPayload.callbackUrl,
是的,
假);
pgResp.then((值){
印刷品(价值);
设置状态(){
widget.success=value['RESPCODE']==01;
});
}).catchError((onError){
设置状态(){
widget.success=false;
});
});
}
}
@凌驾
小部件构建(构建上下文){
返回脚手架(
正文:安全区(
孩子:未来建设者(
生成器:(上下文,快照){
if(widget.success==true){
打印(“付款成功”);
pop(上下文,true);
}else if(widget.success==false){
打印(“付款未成功”);
pop(上下文,false);
}
返回中心(
子:列(
mainAxisAlignment:mainAxisAlignment.center,
crossAxisAlignment:crossAxisAlignment.center,
儿童:[
Text('我们正在处理您的交易',样式:TextStyle(fontSize:36),),
CircularProgressIndicator(),
],
),
);
}
),
),
);
}
}```

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

您应该使用事务状态API通过服务器端请求验证事务响应。此API需要在请求和响应中使用checksumhash。您必须验证e订单ID和金额以及您的数据。在任何情况下,状态都应被视为交易的最终状态。

尝试对交易状态进行API调用时,我总是收到501系统错误。如何解决此问题?您可以连接paytm,他们将解决您的问题。尝试对交易状态进行API调用时在美国,我总是遇到501系统错误。我该如何修复它?
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(),
                  ],
                ),
              );
            }
        ),
      ),
    );
  }

  
}```