【问题标题】:Android paytm integration - Unable to show Payment PageAndroid paytm 集成 - 无法显示付款页面
【发布时间】:2020-05-13 08:58:24
【问题描述】:

我正在尝试将 paytm 支付集成到我的 Android 应用程序中。交易初始化和 CHECKSUM 验证,并且我能够获得交易令牌,但我无法在我的手机上获得 paytm UI。

下面提到的是我得到的日志。我在日志中没有看到任何错误消息。

I/Timeline: Timeline: Activity_launch_request time:611492681 intent:Intent { 
cmp=com.hago.lucky.seven/com.paytm.pgsdk.PaytmPGActivity (has extras) }
W/ActivityThread: handleWindowVisibility: no activity for token 
android.os.BinderProxy@f9c15c4
I/WebViewFactory: Loading com.google.android.webview version 81.0.4044.138 (code 404413803)
I/cr_LibraryLoader: Loaded native library version number "81.0.4044.138"
W/ago.lucky.seve: Accessing hidden method Landroid/content/Context;-    >bindServiceAsUser(Landroid/content/Intent;Landroid/content/ServiceConnection;ILandroid/os/Handl    er;Landroid/os/UserHandle;)Z (light greylist, reflection)
D/EgretLoader: EgretLoader(Context context)
D/EgretLoader: The context is not activity
W/ContentCatcher: Failed to notify a WebView
I/ago.lucky.seve: ProcessProfilingInfo new_methods=0 is saved saved_to_disk=0     resolve_classes_delay=8000
D/ViewRootImpl[PaytmPGActivity]: changeCanvasOpacity: opaque=false
D/ViewRootImpl[PaytmPGActivity]: changeCanvasOpacity: opaque=true
W/ContentCatcher: Failed to notify a WebView

我在 build.gradle 中添加了implementation 'com.paytm:pgplussdk:1.4.4' 我在我的应用级 build.gradle 中添加了maven { url "https://artifactory.paytm.in/libs-release-local" }

我的代码有什么问题?提前致谢。

【问题讨论】:

    标签: android webview paytm


    【解决方案1】:

    我已经与 Paytm 支持分享了我实现的逻辑。

    发现问题是,我有 Paytm 应用程序,该应用程序是从 Play 商店下载并尝试进行分段集成。一旦我卸载了 Paytm 应用程序,它就可以成功运行。

    我从 Paytm 支持获得此信息

    【讨论】:

      【解决方案2】:

      我建议您迁移到新的 Paytm All-in-one SDK。它很容易集成。即使客户没有在他的手机上安装 paytm 应用程序,它也可以工作。 Paytm 正式转向 All-in-one SDK。在项目级 gradle 中使用以下依赖项。

        maven {
                  url "https://artifactory.paytm.in/libs-release-local"
              }
      

      在模块级gradle中使用

      // implementation ‘com.paytm.appinvokesdk:appinvokesdk:1.2’
      

      您需要从您的服务器生成交易令牌。它与我们之前用于 paytm 的校验和相同,但代码不同。因此,请仅使用新的生成交易令牌 php 代码。 获得令牌后,启动 paytm 支付交易管理器。

      public void startPaytmPayment (String token){
          txnTokenString = token;
          // for test mode use it 
         // String host = "https://securegw-stage.paytm.in/";
          // for production mode use it
          String host = "https://securegw.paytm.in/";
          String orderDetails = "MID: " + midString + ", OrderId: " + orderIdString + ", TxnToken: " + txnTokenString
                  + ", Amount: " + txnAmountString;
          //Log.e(TAG, "order details "+ orderDetails);
          String callBackUrl = host + "theia/paytmCallback?ORDER_ID="+orderIdString;
          Log.e(TAG, " callback URL "+callBackUrl);
          PaytmOrder paytmOrder = new PaytmOrder(orderIdString, midString, txnTokenString, txnAmountString, callBackUrl);
          TransactionManager transactionManager = new TransactionManager(paytmOrder, new PaytmPaymentTransactionCallback(){
              @Override
              public void onTransactionResponse(Bundle bundle) {
                  Log.e(TAG, "Response (onTransactionResponse) : "+bundle.toString());
              }
              @Override
              public void networkNotAvailable() {
                  Log.e(TAG, "network not available ");
              }
              @Override
              public void onErrorProceed(String s) {
                  Log.e(TAG, " onErrorProcess "+s.toString());
              }
              @Override
              public void clientAuthenticationFailed(String s) {
                  Log.e(TAG, "Clientauth "+s);
              }
              @Override
              public void someUIErrorOccurred(String s) {
                  Log.e(TAG, " UI error "+s);
              }
              @Override
              public void onErrorLoadingWebPage(int i, String s, String s1) {
                  Log.e(TAG, " error loading web "+s+"--"+s1);
              }
              @Override
              public void onBackPressedCancelTransaction() {
                  Log.e(TAG, "backPress ");
              }
              @Override
              public void onTransactionCancel(String s, Bundle bundle) {
                  Log.e(TAG, " transaction cancel "+s);
              }
          });
          transactionManager.setShowPaymentUrl(host + "theia/api/v1/showPaymentPage");
          transactionManager.startTransaction(this, ActivityRequestCode);
      }
      

      请阅读complete details and source code here

      【讨论】:

      • 您好,我遇到了问题。如果未安装 paytm,那么我在网络流程中遇到错误。
      • 您好 Kamak 先生,我看过您的最新视频,但我收到此错误“Token Res java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.pm.PackageManager android.content.Context .getPackageManager()' 在空对象引用上"
      • 这一行有问题:transactionManager.startTransaction(getActivity(), ActivityRequestCode);
      猜你喜欢
      • 2016-01-27
      • 1970-01-01
      • 2021-10-11
      • 1970-01-01
      • 2013-11-01
      • 2019-11-24
      • 1970-01-01
      • 2014-07-12
      • 1970-01-01
      相关资源
      最近更新 更多