Android paytm集成-无法显示付款页面

时间:2020-05-13 08:58:24

标签: android webview paytm

我正在尝试将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" }

我们的代码有什么问题?预先感谢。

2 个答案:

答案 0 :(得分:0)

我已经分享了通过Paytm suppor实现的逻辑。

发现该问题是,我有从Play商店下载的Paytm应用,并尝试进行阶段集成。卸载Paytm应用后,它就可以成功运行。

我从Paytm支持部门获得了此信息

答案 1 :(得分:0)

我建议您使用新的Paytm多合一SDK。它很容易集成。即使没有在手机上安装paytm应用程序的客户也可以使用。 Paytm正式迁移到多合一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

相关问题