mercredi 15 juin 2016

Paypal Payment : After successful payment , how to match success request api with paypal

Edit:

After paypal login, I could successfully complete transaction.But I need to match the successUrl in paypal to verify both url is same and then display successful toast message.

But I am not getting success url from payment.So I can't match it.Below I have posted the relevant code:

WebActivity.java:

public class WebActivity extends ActionBarActivity {

    private WebView webView;

    WebSettings settings;

    String payUrlStr;

    String successUrl;


    ProgressDialog dialog;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.web_activity);

        dialog = ProgressDialog.show(WebActivity.this, "", "Please wait..", false);

        successUrl = "http://www.myapi.com/page_managements/page_featured_subscription_payment_success"; // Changed server name


        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);

        webView.getSettings().setBuiltInZoomControls(true);

        settings= webView.getSettings();

        if (Build.VERSION.SDK_INT >= 21) {
            settings.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);

                return true;
            }

            @Override
            public void onPageFinished(WebView view, String url) {
                Log.e("Finished url...", url);

                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 this discussion.step by step I put screenshots and added content for clear understanding.

is it possible to match success request with paypal? If I get any suggestion, it will be helpful to me.

Aucun commentaire:

Enregistrer un commentaire