我的应用程序中的Paytm集成

时间:2018-07-31 06:42:03

标签: java android transactions paytm

我在paytm中创建沙箱帐户。我正在使用github代码并将商户ID和所有参数传递给paytm。请检查以下代码

public void onStartTransaction(View view) {
    PaytmPGService Service = PaytmPGService.getStagingService();
    Map<String, String> paramMap = new HashMap<String, String>();

    // these are mandatory parameters

    paramMap.put("ORDER_ID", ((EditText) findViewById(R.id.order_id)).getText().toString());
    paramMap.put("MID", ((EditText) findViewById(R.id.merchant_id)).getText().toString());
    paramMap.put("CUST_ID", ((EditText) findViewById(R.id.customer_id)).getText().toString());
    paramMap.put("CHANNEL_ID", ((EditText) findViewById(R.id.channel_id)).getText().toString());
    paramMap.put("INDUSTRY_TYPE_ID", ((EditText) findViewById(R.id.industry_type_id)).getText().toString());
    paramMap.put("WEBSITE", ((EditText) findViewById(R.id.website)).getText().toString());
    paramMap.put("TXN_AMOUNT", ((EditText) findViewById(R.id.transaction_amount)).getText().toString());
    paramMap.put("THEME", ((EditText) findViewById(R.id.theme)).getText().toString());
    paramMap.put("EMAIL", ((EditText) findViewById(R.id.cust_email_id)).getText().toString());
    paramMap.put("MOBILE_NO", ((EditText) findViewById(R.id.cust_mobile_no)).getText().toString());
    PaytmOrder Order = new PaytmOrder(paramMap);

    PaytmMerchant Merchant = new PaytmMerchant(
            "https://pguat.paytm.com/paytmchecksum/paytmCheckSumGenerator.jsp",
            "https://pguat.paytm.com/paytmchecksum/paytmCheckSumVerify.jsp");


    Service.initialize(Order, Merchant, null);

    Service.startPaymentTransaction(this, true, true,
            new PaytmPaymentTransactionCallback() {
                @Override
                public void someUIErrorOccurred(String inErrorMessage) {
                    Toast.makeText(getApplicationContext(), "Ui/Webview error occured.", Toast.LENGTH_LONG).show();

                }

                @Override
                public void onTransactionSuccess(Bundle inResponse) {
                    Log.d("LOG", "Payment Transaction is successful " + inResponse);
                    Toast.makeText(getApplicationContext(), "Payment Transaction is successful ", Toast.LENGTH_LONG).show();
                }

                @Override
                public void onTransactionFailure(String inErrorMessage,
                        Bundle inResponse) {
                    Log.d("LOG", "Payment Transaction Failed " + inErrorMessage);
                    Toast.makeText(getBaseContext(), "Payment Transaction Failed ", Toast.LENGTH_LONG).show();
                    recreate();
                }

                @Override
                public void networkNotAvailable() {

                    Toast.makeText(getBaseContext(), "No Internet connection.", Toast.LENGTH_LONG).show();

                }

                @Override
                public void clientAuthenticationFailed(String inErrorMessage) {

                    Toast.makeText(getBaseContext(), "Client Authentication Failed.", Toast.LENGTH_LONG).show();

                }

                @Override
                public void onErrorLoadingWebPage(int iniErrorCode,
                        String inErrorMessage, String inFailingUrl) {

                }


                @Override
                public void onBackPressedCancelTransaction() {
                    // TODO Auto-generated method stub
                }

            });
}

在附件下方,我将参数传递给PaytmPGService。请检查附件

enter image description here

点击确认订单后,我得到了这个屏幕,请检查附件

enter image description here

所以请检查并帮助我...

2 个答案:

答案 0 :(得分:0)

还有一些服务器端实现,请确保您的chechksum是从服务器生成的。

答案 1 :(得分:0)

需要注意的几件事:

确认您提供了用于生成校验和的所有必需参数到服务器。

请确保当paytm命中服务器URL时,它会生成与返回给应用程序相同的校验和。

在进行登台测试时,将在其登台服务器中配置您的凭据,在生产服务器上对其进行配置。

从他们的角度确定他们是否启用了所有必需的选项,例如cc / dc等。