paytm / Paytm_Payments_Android_Sample_Apps

12 stars 36 forks source link

Not getting payment response in onTransactionResponse(Bundle bundle) method when paytm app is not installed #2

Open tyagi-priyam opened 4 years ago

tyagi-priyam commented 4 years ago

Payment flow is working fine when paytm app is already installed in the device but in case paytm app is not installed, sdk is launching a webview and after payment completion the callback url is getting loaded in the same webview and i am not receiving payment response in the callback method of PaytmPaymentTransactionCallback() interface. And the webview stays there only unless i press back button. `PaytmOrder paytmOrder = new PaytmOrder(order_id, BuildConfig.PAYTM_KEY, token, amount, BuildConfig.PAYTM_CALLBACK_URL.replace("[[order_id]]",order_id));

TransactionManager manager = new TransactionManager(paytmOrder, new PaytmPaymentTransactionCallback() { @Override public void onTransactionResponse(Bundle bundle) { Log.d("ecedcc: ", "onTransactionResponse called"); if (bundle != null) { for (String key : bundle.keySet()) { Log.e("ecedcc: ", key + " : " + (bundle.get(key) != null ? bundle.get(key) : "NULL")); } } else { Log.d("ecedcc: ", "paytm result bundle null"); showPaymentFailed(Constants.DEFAULT_WALLET); } }

            @Override
            public void networkNotAvailable() {
                Log.d("ecedcc: ", "networkNotAvailable called");
                showPaymentFailed(Constants.DEFAULT_WALLET);
            }

            @Override
            public void onErrorProceed(String s) {
                Log.d("ecedcc: ", "onErrorProceed called");
                showPaymentFailed(Constants.DEFAULT_WALLET);
            }

            @Override
            public void clientAuthenticationFailed(String s) {
                Log.d("ecedcc: ", "clientAuthenticationFailed called");
                showPaymentFailed(Constants.DEFAULT_WALLET);
            }

            @Override
            public void someUIErrorOccurred(String s) {
                Log.d("ecedcc: ", "someUIErrorOccurred called");
                showPaymentFailed(Constants.DEFAULT_WALLET);
            }

            @Override
            public void onErrorLoadingWebPage(int i, String s, String s1) {
                Log.d("ecedcc: ", "onErrorLoadingWebPage called");
                showPaymentFailed(Constants.DEFAULT_WALLET);
            }

            @Override
            public void onBackPressedCancelTransaction() {
                Log.d("ecedcc: ", "onBackPressedCancelTransaction called");
                showPaymentFailed(Constants.DEFAULT_WALLET);
            }

            @Override
            public void onTransactionCancel(String s, Bundle bundle) {
                Log.d("ecedcc: ", "onTransactionCancel called");
                showPaymentFailed(Constants.DEFAULT_WALLET);
            }
        });
        manager.setShowPaymentUrl("https://securegw.paytm.in/theia/api/v1/showPaymentPage");
        manager.startTransaction(GatewayActivity.this, PAYTM_REQUEST_CODE);

`

callback url = https://securegw.paytm.in/theia/paytmCallback?ORDER_ID=[[order_id]]

tyagi-priyam commented 4 years ago

The callback url which is getting loaded in the webview after payment process is https://payments.circle.page/verify

This callback is being used to generate txnToken in the backend

Wangab commented 4 years ago

I have the same problem, how can I solve this problem

puneet8-sharma commented 3 years ago

Hi Guys The problem you have been facing is wrong callback url. Whenever you generate txnToken, you are expected to pass a callback url field which will be configured against that transaction and that callback url should be Paytm Static callback url (https://securegw.paytm.in/theia/paytmCallback?ORDER_ID=order_id), any other url will prevent webview from getting closed. Please make changes accordingly and let us know if issue still persists.

harshabhadra commented 3 years ago

Hi Guys The problem you have been facing is wrong callback url. Whenever you generate txnToken, you are expected to pass a callback url field which will be configured against that transaction and that callback url should be Paytm Static callback url (https://securegw.paytm.in/theia/paytmCallback?ORDER_ID=order_id), any other url will prevent webview from getting closed. Please make changes accordingly and let us know if issue still persists.

I'm using the same callback url you mentioned still I'm facing the same issue. If PayTm app is not is in user's phone then webview is opening after payment.

puneet8-sharma commented 3 years ago

Hi Guys The problem you have been facing is wrong callback url. Whenever you generate txnToken, you are expected to pass a callback url field which will be configured against that transaction and that callback url should be Paytm Static callback url (https://securegw.paytm.in/theia/paytmCallback?ORDER_ID=order_id), any other url will prevent webview from getting closed. Please make changes accordingly and let us know if issue still persists.

I'm using the same callback url you mentioned still I'm facing the same issue. If PayTm app is not is in user's phone then webview is opening after payment.

For clarification, this is the callback url configured against your mid on merchant dashboard and this is the same callback url you are passing to generate 'txnToken' from backend.

harshabhadra commented 3 years ago

Hi Guys The problem you have been facing is wrong callback url. Whenever you generate txnToken, you are expected to pass a callback url field which will be configured against that transaction and that callback url should be Paytm Static callback url (https://securegw.paytm.in/theia/paytmCallback?ORDER_ID=order_id), any other url will prevent webview from getting closed. Please make changes accordingly and let us know if issue still persists.

I'm using the same callback url you mentioned still I'm facing the same issue. If PayTm app is not is in user's phone then webview is opening after payment.

For clarification, this is the callback url configured against your mid on merchant dashboard and this is the same callback url you are passing to generate 'txnToken' from backend.

Thank you it solved my issue and it's working fine now. The problem is in Initiate transaction api documentation callbackurl parameter is optional but in sdk integration documentation(Android) callbackurl is mandatory that's why we are facing this issue.

puneet8-sharma commented 3 years ago

Happy to help.

puneet8-sharma commented 3 years ago

@harshabhadra please mark the issue closed.

harshabhadra commented 3 years ago

@harshabhadra please mark the issue closed.

I didn't open this issue

lzzy12 commented 3 years ago

@puneet8-sharma In that case how am I going to get a callback to my backend about the status of the payment?

puneet8-sharma commented 3 years ago

@puneet8-sharma In that case how am I going to get a callback to my backend about the status of the payment?

You can use order status API to get the status of specific order or you can use the response provided in onTransactionResponse

lzzy12 commented 3 years ago

@puneet8-sharma In that case how am I going to get a callback to my backend about the status of the payment?

You can use order status API to get the status of specific order or you can use the response provided in onTransactionResponse

When should I call the order status API? I mean should I schedule it to call after a fixed interval of time after I create a transaction token on my backend or am I missing something here?

About using onTransactionResponse, I don't think we should depend on the client to do this, should we? Stripe have a concept of webhooks which paytm also seems to have but we have to contact the support to set it up? That seems too weird, shouldn't we just have an option on the dashboard?

puneet8-sharma commented 3 years ago

@puneet8-sharma In that case how am I going to get a callback to my backend about the status of the payment?

You can use order status API to get the status of specific order or you can use the response provided in onTransactionResponse

When should I call the order status API? I mean should I schedule it to call after a fixed interval of time after I create a transaction token on my backend or am I missing something here?

About using onTransactionResponse, I don't think we should depend on the client to do this, should we? Stripe have a concept of webhooks which paytm also seems to have but we have to contact the support to set it up? That seems too weird, shouldn't we just have an option on the dashboard?

Well you can hit that API once you receive callback in onTransactionResponse and also you can poll this API if possible on certain repetitive interval.

gharShaddi commented 3 years ago

I'm also facing the same issue still webview is opening after a transaction is complete or failed or canceled now I don't understand what to do if I set callback URL as mentioned above then when to execute callback from application to my server and one more thing where do can add additional payload like notes or id of post ?

rohitthakre commented 3 years ago

Hi Guys The problem you have been facing is wrong callback url. Whenever you generate txnToken, you are expected to pass a callback url field which will be configured against that transaction and that callback url should be Paytm Static callback url (https://securegw.paytm.in/theia/paytmCallback?ORDER_ID=order_id), any other url will prevent webview from getting closed. Please make changes accordingly and let us know if issue still persists.

I'm using the same callback url you mentioned still I'm facing the same issue. If PayTm app is not is in user's phone then webview is opening after payment.

Payment flow is working fine when paytm app is already installed in the device but in case paytm app is not installed, sdk is launching a webview and after payment completion the callback url is getting loaded in the same webview and i am not receiving payment response in the callback method of PaytmPaymentTransactionCallback() interface. And the webview stays there only unless i press back button. `PaytmOrder paytmOrder = new PaytmOrder(order_id, BuildConfig.PAYTM_KEY, token, amount, BuildConfig.PAYTM_CALLBACK_URL.replace("[[order_id]]",order_id));

TransactionManager manager = new TransactionManager(paytmOrder, new PaytmPaymentTransactionCallback() { @override public void onTransactionResponse(Bundle bundle) { Log.d("ecedcc: ", "onTransactionResponse called"); if (bundle != null) { for (String key : bundle.keySet()) { Log.e("ecedcc: ", key + " : " + (bundle.get(key) != null ? bundle.get(key) : "NULL")); } } else { Log.d("ecedcc: ", "paytm result bundle null"); showPaymentFailed(Constants.DEFAULT_WALLET); } }

            @Override
            public void networkNotAvailable() {
                Log.d("ecedcc: ", "networkNotAvailable called");
                showPaymentFailed(Constants.DEFAULT_WALLET);
            }

            @Override
            public void onErrorProceed(String s) {
                Log.d("ecedcc: ", "onErrorProceed called");
                showPaymentFailed(Constants.DEFAULT_WALLET);
            }

            @Override
            public void clientAuthenticationFailed(String s) {
                Log.d("ecedcc: ", "clientAuthenticationFailed called");
                showPaymentFailed(Constants.DEFAULT_WALLET);
            }

            @Override
            public void someUIErrorOccurred(String s) {
                Log.d("ecedcc: ", "someUIErrorOccurred called");
                showPaymentFailed(Constants.DEFAULT_WALLET);
            }

            @Override
            public void onErrorLoadingWebPage(int i, String s, String s1) {
                Log.d("ecedcc: ", "onErrorLoadingWebPage called");
                showPaymentFailed(Constants.DEFAULT_WALLET);
            }

            @Override
            public void onBackPressedCancelTransaction() {
                Log.d("ecedcc: ", "onBackPressedCancelTransaction called");
                showPaymentFailed(Constants.DEFAULT_WALLET);
            }

            @Override
            public void onTransactionCancel(String s, Bundle bundle) {
                Log.d("ecedcc: ", "onTransactionCancel called");
                showPaymentFailed(Constants.DEFAULT_WALLET);
            }
        });
        manager.setShowPaymentUrl("https://securegw.paytm.in/theia/api/v1/showPaymentPage");
        manager.startTransaction(GatewayActivity.this, PAYTM_REQUEST_CODE);

`

callback url = https://securegw.paytm.in/theia/paytmCallback?ORDER_ID=[[order_id]]

hello there anyone find that solution in paytm web view

rohitthakre commented 3 years ago

please comment

soumyavats commented 3 years ago

@rohitthakre you are passing the same callback URL in initiate transaction request also?

rohitthakre commented 3 years ago

@rohitthakre you are passing the same callback URL in initiate transaction request also?

initialtrasaction puting the checksum api with oderid amount and userid

thats ok but problem is that if you phone in it payty app install then no problem if app not install then show web view transaction done all process at the last time show page not found she 404 page not found

rohitthakre commented 3 years ago

any idea about that

soumyavats commented 3 years ago

@rohitthakre please send a video of the issue you are facing on integration.dev@paytm.com. Please also attach the initiate transaction request

soumyavats commented 3 years ago

any idea about that

initiate transaction request should also contain callbackUrl param in request, the callback url should be same as one being passed from apps side

rohitthakre commented 3 years ago

@rohitthakre you are passing the same callback URL in initiate transaction request also?

any idea about that

soumyavats commented 3 years ago

@rohitthakre you are passing the same callback URL in initiate transaction request also?

any idea about that

@rohitthakre please send a video of the issue you are facing on integration.dev@paytm.com. Please also attach the initiate transaction request

srinivasudadi9000 commented 3 years ago

https://merchant.com/callback?retryAllowed=false&errorMessage=OrderId%20in%20the%20query%20param%20doesn

I am getting above error message in paytm call back

soumyavats commented 3 years ago

You need to pass the same orderid from your android end which you are sending while making transaction token

Ashish-jangir commented 2 years ago

my webview is not even opening but app invoke flow is working fine. i am getting this error in console: E/chromium: [ERROR:simple_index_file_posix.cc(36)] opendir /data/user/0/com.harn.hanscure/cache/WebView/Default/HTTP Cache/Code Cache/wasm: No such file or directory (2) E/chromium: [ERROR:simple_index_file.cc(577)] Could not reconstruct index from disk E/chromium: [ERROR:simple_index_file_posix.cc(36)] opendir /data/user/0/com.harn.hanscure/cache/WebView/Default/HTTP Cache/Code Cache/js: No such file or directory (2) E/chromium: [ERROR:simple_index_file.cc(577)] Could not reconstruct index from disk

Ashish-jangir commented 2 years ago

my webview is not even opening but app invoke flow is working fine. i am getting this error in console: E/chromium: [ERROR:simple_index_file_posix.cc(36)] opendir /data/user/0/com.harn.hanscure/cache/WebView/Default/HTTP Cache/Code Cache/wasm: No such file or directory (2) E/chromium: [ERROR:simple_index_file.cc(577)] Could not reconstruct index from disk E/chromium: [ERROR:simple_index_file_posix.cc(36)] opendir /data/user/0/com.harn.hanscure/cache/WebView/Default/HTTP Cache/Code Cache/js: No such file or directory (2) E/chromium: [ERROR:simple_index_file.cc(577)] Could not reconstruct index from disk

Sorry was my mistake i was using transactionManager.setShowPaymentUrl("https://securegw-stage.paytm.in/theia/api/v1/showPaymentPage"); in real environment. and was passing wrong callbackUrl to PaytmOrder object.

gharShaddi commented 2 years ago

What's the issue ?

On Tue, 31 May, 2022, 4:15 pm Ashish Jangir, @.***> wrote:

my webview is not even opening but app invoke flow is working fine. i am getting this error in console: E/chromium: [ERROR:simple_index_file_posix.cc(36)] opendir /data/user/0/com.harn.hanscure/cache/WebView/Default/HTTP Cache/Code Cache/wasm: No such file or directory (2) E/chromium: [ERROR:simple_index_file.cc(577)] Could not reconstruct index from disk E/chromium: [ERROR:simple_index_file_posix.cc(36)] opendir /data/user/0/com.harn.hanscure/cache/WebView/Default/HTTP Cache/Code Cache/js: No such file or directory (2) E/chromium: [ERROR:simple_index_file.cc(577)] Could not reconstruct index from disk

Sorry was my mistake i was using transactionManager.setShowPaymentUrl(" https://securegw-stage.paytm.in/theia/api/v1/showPaymentPage"); in real environment.

— Reply to this email directly, view it on GitHub https://github.com/paytm/Paytm_Payments_Android_Sample_Apps/issues/2#issuecomment-1141972099, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOWK5R5MVCLHS3C2HQ75MSTVMXUURANCNFSM4NRAQNFQ . You are receiving this because you commented.Message ID: @.***>

Udbhav9628 commented 2 years ago

I am not Getting responce on callback url, doing every thing right

sawrubgupta commented 1 year ago

YEAH same happening with me, not getting any response from callback and webhook on server side