Ошибка несоответствия контрольной суммы PayTM интеграции платежей - PullRequest
0 голосов
/ 21 декабря 2018

Я пытаюсь внедрить платежный шлюз в моем приложении, но он выдает Bundle[{STATUS=TXN_FAILURE, ORDERID=order1, TXNAMOUNT=7.00, MID=cdBOMy65033449597261, RESPCODE=330, BANKTXNID=, CURRENCY=INR, RESPMSG=Paytm checksum mismatch.}] эту ошибку как для TEST, так и для производственной среды.

Вот мой PHP-код для генерации контрольной суммы.

$paytmParams = array();
$paytmParams["MID"] = "cdBOMy65033449597261";
$paytmParams["ORDER_ID"] = "order1";
$paytmParams["CUST_ID"] = "cust1";
$paytmParams["MOBILE_NO"] = "9799990168";
$paytmParams["EMAIL"] = "droidwithme@gmail.com";
$paytmParams["CHANNEL_ID"] = "WAP";
$paytmParams["TXN_AMOUNT"] = "7.00";
$paytmParams["WEBSITE"] = "DEFAULT"; //tried WEBSTAGING and APPSTAGING
$paytmParams["INDUSTRY_TYPE_ID"] = "Retail";
$paytmParams["CALLBACK_URL"] = "https://securegw.paytm.in/theia/paytmCallback?ORDER_ID=order1";

//Here checksum string will return by getChecksumFromArray() function.
$paytmChecksum = EndecPaytm::getChecksumFromArray($paytmParams, $merchantKey);

$responseBody = [
    'message' => 'Checksum Generated.',
    'data' => [
        "CHECKSUMHASH" => $paytmChecksum,
        "ORDER_ID" => "order1",
        "payt_STATUS" => "1"
    ]
];
return ApiMethods::apiResponse('success', $responseBody);

А это мой код для Android,

     private void getPaytmWindow(String chkSm) {
        PaytmPGService Service = PaytmPGService.getProductionService();
        //Kindly create complete Map and checksum on your server side and then put it here in paramMap.


        HashMap<String, String> paramMap = new HashMap<>();
        paramMap.put( "MID" , "cdBOMy65033449597261"); //cdBOMy65033449597261
// Key in your staging and production MID available in your dashboard
        paramMap.put( "ORDER_ID" , "order1");
        paramMap.put( "CUST_ID" , "cust1");
        paramMap.put( "MOBILE_NO" , "9799990168");
        paramMap.put( "EMAIL" , "droidwithme@gmail.com");
        paramMap.put( "CHANNEL_ID" , "WAP");
        paramMap.put( "TXN_AMOUNT" , "7.00");
        paramMap.put( "WEBSITE" , "DEFAULT");
// This is the staging value. Production value is available in your dashboard
        paramMap.put( "INDUSTRY_TYPE_ID" , "Retail");
// This is the staging value. Production value is available in your dashboard
        paramMap.put( "CALLBACK_URL", "https://securegw.paytm.in/theia/paytmCallback?ORDER_ID=order1");
        paramMap.put( "CHECKSUMHASH" , chkSm);

        PaytmOrder Order = new PaytmOrder(paramMap);
        Service.initialize(Order, null);
        Service.startPaymentTransaction(this, true, true,
                new PaytmPaymentTransactionCallback() {
                    @Override
                    public void someUIErrorOccurred(String inErrorMessage) {
                        // Some UI Error Occurred in Payment Gateway Activity.
                        // // This may be due to initialization of views in
                        // Payment Gateway Activity or may be due to //
                        // initialization of webview. // Error Message details
                        // the error occurred.
                        Utils.logD(TAG, "someUIErrorOccurred : " + inErrorMessage);
                    }

                    @Override
                    public void onTransactionResponse(Bundle inResponse) {
                        Log.d("LOG123444", "Payment Transaction : " + inResponse);

                        if (Objects.requireNonNull(inResponse.getString("STATUS")).contains("TXN_SUCCESS")) {

                            Toast.makeText(getApplicationContext(), "Transaction completed", Toast.LENGTH_LONG).show();
                        }


                        Utils.logD(TAG, inResponse.getString("STATUS"));

//                        Toast.makeText( getApplicationContext(), "Payment Transaction response " + inResponse.toString(), Toast.LENGTH_LONG ).show();
                    }

                    @Override
                    public void networkNotAvailable() {
                        // If network is not
                        // available, then this
                        // method gets called.
                    }

                    @Override
                    public void clientAuthenticationFailed(String inErrorMessage) {
                        // This method gets called if client authentication
                        // failed. // Failure may be due to following reasons //
                        // 1. Server error or downtime. // 2. Server unable to
                        // generate checksum or checksum response is not in
                        // proper format. // 3. Server failed to authenticate
                        // that client. That is value of payt_STATUS is 2. //
                        // Error Message describes the reason for failure.
                        Utils.logD(TAG, "clientAuthenticationFailed " + inErrorMessage);
                    }

                    @Override
                    public void onErrorLoadingWebPage(int iniErrorCode,
                                                      String inErrorMessage, String inFailingUrl) {
                        Utils.logD(TAG, "inErrorMessage " + inErrorMessage);
                        Utils.logD(TAG, "inFailingUrl " + inFailingUrl);

                    }

                    // had to be added: NOTE
                    @Override
                    public void onBackPressedCancelTransaction() {
                        // TODO Auto-generated method stub
                    }

                    @Override
                    public void onTransactionCancel(String inErrorMessage, Bundle inResponse) {
                        Utils.logD(TAG, "Payment Transaction Failed " + inErrorMessage);
                        Toast.makeText(getBaseContext(), "Payment Transaction Failed ", Toast.LENGTH_LONG).show();
                    }


                });

    }

Это зависимость от gradle

 implementation('com.paytm:pgplussdk:1.2.3') {
    transitive = true
}

Я также пробовал среду тестирования и производство, но получаюошибка несоответствия контрольной суммы каждый раз.Для целей тестирования я установил значения в жестком коде.Я просматривал различные темы на форуме PayTM QA, но они не дали достаточного ответа темам (тем же, что и у меня).

...