“网页不可用,无法加载http://xxx.xxx.xxx.xx:3000 / pgSimulator / axis / redirect上的网页。net :: ERR_CLEARTEXT_NOT_PERMITTED”

时间:2019-02-08 05:56:32

标签: java android android-studio payment-gateway payumoney

我正在将Payumoney付款网关集成到我的Android应用中。但是,当我尝试通过测试借记卡进行测试交易时。显示错误。 当我与payumoney客户服务中心联系时,他们说要将该服务器的网址列入白名单。我不知道如何将url ito服务器列入白名单。

public void startpay() {

    builder.setAmount(amount)                          // Payment amount
            .setTxnId(txnid)                         // Transaction ID
            .setPhone(phone)                   // User Phone number
            .setProductName(prodname)                   // Product Name or description
            .setFirstName(firstname)                              // User First name
            .setEmail(email)              // User Email ID
            .setsUrl("https://www.payumoney.com/mobileapp/payumoney/success.php")     // Success URL (surl)
            .setfUrl("https://www.payumoney.com/mobileapp/payumoney/failure.php")     //Failure URL (furl)
            .setUdf1("")
            .setUdf2("")
            .setUdf3("")
            .setUdf4("")
            .setUdf5("")
            .setUdf6("")
            .setUdf7("")
            .setUdf8("")
            .setUdf9("")
            .setUdf10("")
            .setIsDebug(true)                              // Integration environment - true (Debug)/ false(Production)
            .setKey(merchantkey)                        // Merchant key
            .setMerchantId(merchantId);


    try {
        paymentParam = builder.build();
        // generateHashFromServer(paymentParam );
        getHashkey();

    } catch (Exception e) {
        Log.e(TAG, " error s " + e.toString());
    }

}





public void getHashkey() {
    ServiceWrapper service = new ServiceWrapper(null);
    Call<String> call = service.newHashCall(merchantkey, txnid, amount, prodname,
            firstname, email);


    call.enqueue(new Callback<String>() {
        @Override
        public void onResponse(Call<String> call, Response<String> response) {
            Log.e(TAG, "hash res " + response.body());
            String merchantHash = response.body();
            if (merchantHash.isEmpty() || merchantHash.equals("")) {
                Toast.makeText(StartPaymentActivity.this, "Could not generate hash", Toast.LENGTH_SHORT).show();
                Log.e(TAG, "hash empty");
            } else {
                // mPaymentParams.setMerchantHash(merchantHash);
                paymentParam.setMerchantHash(merchantHash);
                // Invoke the following function to open the checkout page.
                // PayUmoneyFlowManager.startPayUMoneyFlow(paymentParam, StartPaymentActivity.this,-1, true);
                PayUmoneyFlowManager.startPayUMoneyFlow(paymentParam, StartPaymentActivity.this, R.style.AppTheme_default, false);
            }
        }

        @Override
        public void onFailure(Call<String> call, Throwable t) {
            Log.e(TAG, "hash error " + t.toString());
        }
    });

}

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);

    //PayUMoneySdk: Success -- merchantResponse438104
    // on successfull txn
    //  request code 10000 resultcode -1

    // Result Code is -1 send from Payumoney activity
        Log.e("StartPaymentActivity", "request code " + requestCode + " resultcode " + resultCode);
    if (requestCode == PayUmoneyFlowManager.REQUEST_CODE_PAYMENT && resultCode == RESULT_OK && data != null) {
        TransactionResponse transactionResponse = data.getParcelableExtra(PayUmoneyFlowManager.INTENT_EXTRA_TRANSACTION_RESPONSE);

        if (transactionResponse != null && transactionResponse.getPayuResponse() != null) {

            if (transactionResponse.getTransactionStatus().equals(TransactionResponse.TransactionStatus.SUCCESSFUL)) {
                //Success Transaction

                Toast.makeText(this, "Payment successful", Toast.LENGTH_SHORT).show();
            } else {
                //Failure Transaction
                Toast.makeText(this, "Payment failed", Toast.LENGTH_SHORT).show();

            }

            // Response from Payumoney
            //String payuResponse = transactionResponse.getPayuResponse();

            // Response from SURl and FURL
            //String merchantResponse = transactionResponse.getTransactionDetails();
            //Log.e(TAG, "tran " + payuResponse + "---" + merchantResponse);
        } /* else if (resultModel != null && resultModel.getError() != null) {
            Log.d(TAG, "Error response : " + resultModel.getError().getTransactionResponse());
        } else {
            Log.d(TAG, "Both objects are null!");
        }*/
    }
}







@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);

    //PayUMoneySdk: Success -- merchantResponse438104
    // on successfull txn
    //  request code 10000 resultcode -1

    // Result Code is -1 send from Payumoney activity
        Log.e("StartPaymentActivity", "request code " + requestCode + " resultcode " + resultCode);
    if (requestCode == PayUmoneyFlowManager.REQUEST_CODE_PAYMENT && resultCode == RESULT_OK && data != null) {
        TransactionResponse transactionResponse = data.getParcelableExtra(PayUmoneyFlowManager.INTENT_EXTRA_TRANSACTION_RESPONSE);

        if (transactionResponse != null && transactionResponse.getPayuResponse() != null) {

            if (transactionResponse.getTransactionStatus().equals(TransactionResponse.TransactionStatus.SUCCESSFUL)) {
                //Success Transaction

                Toast.makeText(this, "Payment successful", Toast.LENGTH_SHORT).show();
            } else {
                //Failure Transaction
                Toast.makeText(this, "Payment failed", Toast.LENGTH_SHORT).show();

            }

            // Response from Payumoney
            //String payuResponse = transactionResponse.getPayuResponse();

            // Response from SURl and FURL
            //String merchantResponse = transactionResponse.getTransactionDetails();
            //Log.e(TAG, "tran " + payuResponse + "---" + merchantResponse);

        } 
    }
}

Webpage not available

3 个答案:

答案 0 :(得分:2)

请将此行保留在您的android清单文件中的应用程序标签android:usesCleartextTraffic="true"下,如下所示

AndroidManifest.xml

<application
        android:usesCleartextTraffic="true">

    </application>

答案 1 :(得分:1)

请将此行保留在您的android清单文件中的应用程序标签android:usesCleartextTraffic="true"下,如下所示

<application
             android:usesCleartextTraffic="true"
         tools:replace="usesCleartextTraffic">

    </application>

答案 2 :(得分:0)

之所以会这样,是因为Web网址是 HTTP 而不是 HTTPS this post。)

这里已经回答了。 http://XXX.XXX.XXX.XX:3000/....