androidpayment-gatewaypaytm

PayTm All-in-one Sdk - after successful payment getting error like Webpage not available - callback url error


full error message is : The webpage at https://merchant.com/callback could not be loaded because : net::ERR_CONNECTION_TIME_OUT

enter image description here

my code for initiate paytm and get same error in app invocation :

 private void startPayTMCall(InitiateAPIResponse apiResponse, PaytmInitRequestBody paytmInitRequestBody) {
        String orderIdString = paytmInitRequestBody.getOrderId();
        String MID = getString(R.string.MID);
        String amount = String.valueOf(paytmInitRequestBody.getAmount());

/*
        On completion of transaction, Paytm payment gateway will send the response on this URL. This can be a static response URL as mentioned below:
        Staging Environment: "https://securegw-stage.paytm.in/theia/paytmCallback?ORDER_ID=<order_id>"
        Production Environment: "https://securegw.paytm.in/theia/paytmCallback?ORDER_ID=<order_id>"*/
        // for test mode use it
        // String host = "https://securegw-stage.paytm.in/";
        // for production mode use it
        String host = "https://securegw.paytm.in/";
        String callBackUrl = host + "theia/paytmCallback?ORDER_ID=" + orderIdString;


        PaytmOrder order = new PaytmOrder(orderIdString, MID, apiResponse.getBody().getTxnToken(), amount, callBackUrl);

                            TransactionManager transactionManager = new TransactionManager(order, new PaytmPaymentTransactionCallback() {
                    @Override
                    public void onTransactionResponse(Bundle bundle) {
                        Toast.makeText(getApplicationContext(), "Payment Transaction response " + bundle.toString(), Toast.LENGTH_LONG).show();
                    }

                    @Override
                    public void networkNotAvailable() {
                        Toast.makeText(MainActivity.this, "networkNotAvailable", Toast.LENGTH_SHORT).show();
                    }

                    @Override
                    public void onErrorProceed(String s) {
                        Toast.makeText(MainActivity.this, "onErrorProceed "+s, Toast.LENGTH_SHORT).show();
                    }

                    @Override
                    public void clientAuthenticationFailed(String s) {
                        Toast.makeText(MainActivity.this, "clientAuthenticationFailed : "+s, Toast.LENGTH_SHORT).show();
                    }

                    @Override
                    public void someUIErrorOccurred(String s) {
                        Toast.makeText(MainActivity.this, "someUIErrorOccurred : "+s, Toast.LENGTH_SHORT).show();

                    }

                    @Override
                    public void onErrorLoadingWebPage(int i, String s, String s1) {
                        Toast.makeText(MainActivity.this, "onErrorLoadingWebPage : "+s+" : "+s1, Toast.LENGTH_SHORT).show();

                    }

                    @Override
                    public void onBackPressedCancelTransaction() {
                        Toast.makeText(MainActivity.this, "onBackPressedCancelTransaction : ", Toast.LENGTH_SHORT).show();

                    }

                    @Override
                    public void onTransactionCancel(String s, Bundle bundle) {
                        Toast.makeText(MainActivity.this, "onTransactionCancel : "+s, Toast.LENGTH_SHORT).show();

                    }
                });


        transactionManager.setAppInvokeEnabled(false);
        transactionManager.setEnableAssist(true);
        transactionManager.startTransaction(this, REQ_CODE_ORDER);

    }

i think there is problem in callback url tht could be worng, but i follow paytm official All in one SDK documentation. https://developer.paytm.com/docs/all-in-one-sdk/


Solution

  • Kindly use Paytm Static Callback URL in 'callbackUrl' request param of 'Initiate Transaction API'. The URL mentioned (merchant.com/callback) is just an example, either you can use your customised call back url or use below mentioned call back URL.

    Paytm Static Callback URL ->

    Staging: https://securegw-stage.paytm.in/theia/paytmCallback?ORDER_ID=<order_id>

    Production: https://securegw.paytm.in/theia/paytmCallback?ORDER_ID=<order_id>