Edit:
After logging into PayPal, I was able to successfully complete the transaction. But I need to map successUrl in paypal to check that both URLs are the same and then display a successful message with a toast.
But I do not receive the success URL from the payment. Therefore, I cannot match it. Below I posted the appropriate code:
WebActivity.java:
public class PaypalWebActivity extends Activity { private WebView webView; String payUrlStr; ProgressDialog dialog; String successUrl; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.paypal_web_layout); successUrl = LOAD_WEBVIEW_PAYMENT_PAYPAL_SUCCESS; dialog = ProgressDialog.show(PaypalWebActivity.this, "", "Please wait..", false); loadWebViewPaypal(); } private void loadWebViewPaypal() { payUrlStr = LOAD_WEBVIEW_PAYMENT_PAYPAL(PAGE_ID); Log.e("payUrlStr", ""+payUrlStr); webView = (WebView) findViewById(R.id.webView); webView.loadUrl(payUrlStr); webView.getSettings().setJavaScriptEnabled(true); @SuppressWarnings("unused") WebSettings settings= webView.getSettings(); if (Build.VERSION.SDK_INT >= 21) { webView.getSettings().setMixedContentMode( WebSettings.MIXED_CONTENT_ALWAYS_ALLOW ); } webView.setWebViewClient(new WebViewClient() { @Override public boolean shouldOverrideUrlLoading(WebView view, String url) { Log.e("Loading url...", url); view.loadUrl(url); String loadWebUrl = view.getUrl(); Log.e("loadWebUrl", ""+loadWebUrl); return true; } @Override public void onPageFinished(WebView view, String url) { Log.e("Finished url...", url); String webUrl = view.getUrl(); Log.e("webUrl", ""+webUrl); if(webUrl.substring(0,95).equals(successUrl)){ Log.e("Getting Success Request", "Test"); }else{ Log.e("Failed to get Request", "Test"); } if(dialog.isShowing()){ dialog.dismiss(); } } @Override public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) { Log.e("Error in url...", description); Log.e("Error in failingUrl...", failingUrl); } }); } }
manifest:
<uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" /> <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
check out this discussion . Step by step, I posted screenshots and added content for a clear understanding.
I get a message . This may not match the query:
06-15 18: 12: 59.894: I / chrome (3273): [INFO: CONSOLE (0)] "Mixed Contents: page at ' https://www.sandbox.paypal.com/us/cgi-bin/webscr ? = SESSION LTy9Q59% 5fia3wiAdHTQjgQxvUF1BTzLjgXgelCew4AS% & 2dGAutAfB5WjZXVuX8 dispatch = 5885d80a13c0db1f8e263663d3faee8dcce3e160f5b9538489e17951d2c62172 'was loaded using a secure connection, but comprises a shape such that unsafe endpoint' http://www.myapi-entertainment.com/page_managements/page_featured_subscription_payment_success/4 . this content must also be submitted via HTTPS.https: //www.sandbox.paypal.com/us/cgi-bin/webscr?SESSION=LTy9Q59%5fia3wiAdHTQjgQxvUF1BTzLjgXgelCew4AS%2dGAutAfBe8b88888888888888888888888c88a8a5a5c8a8a5b8a8b8a8a8b88a8a8b8a8b8888888a8b8a8a5c8e5a8b8e8e8e8e8b8a8b8a8b8e8b8e8e8b8b8e8e8b8e1b8e1b8e1b8b8e1b8b8b8b8a8b8aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa!
This is my answer to the success http://www.myapi-entertainment.com/page_managements/page_featured_subscription_payment_success/4 "→ The server name has been changed.
Can I match a success request with paypal? If I get any suggestion, it will be useful for me.
android paypal paypal-sandbox
Steve Jun 01 '16 at 7:13 2016-06-01 07:13
source share