【问题标题】:(Flutter) Paytm Payment Gateway integration(Flutter) Paytm 支付网关集成
【发布时间】:2019-11-24 07:12:52
【问题描述】:

我正在构建一个涉及应用用户在线支付的 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。

【问题讨论】:

  • 为什么不使用网页视图?您在实施基于网络的支付方面面临哪些挑战?
  • @Darish 我已将我的问题更新为更具体。此外,有人否决了这个问题,因此我被禁止提问。现在我更新了问题,现在可以了吗?
  • 您的应用是没有服务器后端的离线应用吗?我希望您已经拥有一台服务器后端来存储用户数据。
  • @Darish 是的,它有 firebase Firestore 作为后端
  • 然后你可以使用 firebase 来托管这些文件

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


【解决方案1】:

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

有一个插件可用于执行此操作,称为 paytmkaro,您可以使用它,但它仅适用于生产密钥。

在开始将服务器端代码上传到服务器上之前,请不要对用于在 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.'
}`

你就完成了。

【讨论】:

    【解决方案2】:

    为了您的方便,使用 webview 实现支付网关更容易。

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

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

    【讨论】:

      猜你喜欢
      • 2016-01-27
      • 2020-09-03
      • 2018-08-15
      • 2020-09-14
      • 2015-10-10
      • 2013-11-01
      • 1970-01-01
      • 2020-06-22
      • 2020-01-29
      相关资源
      最近更新 更多