(Flutter)Paytm支付网关集成

时间:2019-07-15 14:44:28

标签: node.js flutter dart payment-gateway paytm

我正在构建一个Flutter应用程序,其中涉及应用程序用户的在线付款。

我打算使用Paytm付款网关。我打算使用WebView实现此目的。我知道为此,我需要设置服务器以生成校验和。

现在我想了解的是如何设置服务器? 根据这篇文章:https://medium.com/@iqan/flutter-payments-using-paytm-7c48539dfdee 我必须克隆这个github项目:https://github.com/iqans/paytm-checksum-api-nodejs

我在哪里上传这个node.js项目?可以将其上传到Firebase吗?

还是必须将其上载到hostgator之类的网站托管平台上?

请稍作解释,我现在对服务器的了解不多,我刚刚开始使用flutter。

2 个答案:

答案 0 :(得分:1)

为方便起见,使用Webview实施支付网关更加容易。

在您的服务器上托管由支付SDK提供的文件,以计算校验和。

然后,您可以从移动应用程序启动事务,并通过调用服务器端脚本来计算校验和。然后将这些值传递给付款SDK。

答案 1 :(得分:0)

我认为,除了在Webview中使用paytm sdk之外,它更是您的最佳选择,因为当您开始进行横切时,它会从安装在客户移动设备中的paytm应用中获取数据。

有一个名为paytmkaro的插件可用于执行此操作,但您只能使用生产密钥。

开始在服务器上上传服务器端代码(该文档可在here上获得文档之前),请不要对用于在Paytm服务器上生成txn令牌的服务器端代码进行任何更改。

将SDK的最低版本更改为19

然后复制粘贴此代码

` try {
  PaytmResponse paymentResponse = await _paytmKaro.startTransaction(
    url: serverside code url e.g. https://arcane-temple-61754.herokuapp.com/intiateTansection.php,
    mid: your Production merchant id,
    mkey: your merchant key,
    customerId:customer id (must be unique for every customer),
    amount: transection amount,
    orderId: Order Id (Order id must be unique Everytime for every order),
  );

  if(paymentResponse.status=="TXN_SUCCESS"){
    Navigator.push(context, MaterialPageRoute(builder: (context)=>txnSuccessful(paytmResponse: paymentResponse,)));
  }
  else if(paymentResponse.status=="TXN_FAILURE"){
    Navigator.push(context, MaterialPageRoute(builder: (context)=>txnFailed(paytmResponse: paymentResponse,)));
  }
} 
catch(e){
  print(e);
  key.currentState.showSnackBar(SnackBar(content: Text(e.toString())));      // platformVersion = 'Failed to get platform version.'
}`

您已经完成。

相关问题