private void checkout() { if ((isThirdParty && this.ppPaymentM != null) || this.ppPayment != null) { PayPal pp = PayPal.getInstance(); Intent checkoutIntent; if (isThirdParty) { checkoutIntent = pp.checkout( this.ppPaymentM, cordova.getActivity().getApplicationContext(), new PayPalMPLResultDelegate()); } else { checkoutIntent = pp.checkout( this.ppPayment, cordova.getActivity().getApplicationContext(), new PayPalMPLResultDelegate()); } cordova.getActivity().startActivityForResult(checkoutIntent, REQUEST_PAYPAL_CHECKOUT); } else { Log.d(LOGTAG, "payment info not set, call setPaymentInfo first."); } }
// Submit payment (i.e. "checkout") public void pay(Integer btype) { PayPalPayment payment; PayPal pp = PayPal.getInstance(); if (pp == null) return; // mpjs_buttonType; // TBD: payment type: simple, parallel, chained payment = getSimplePayment(); // Intent checkoutIntent = PayPal.getInstance().checkout(payment, this); Intent checkoutIntent = pp.checkout(payment, mpl_context, new ResultDelegate()); // The next two lines should be exchanged for the following commented // line when PhoneGap is not used DroidGap dgActivity = (DroidGap) mpl_activity; dgActivity.startActivityForResult(PayPalPlugin.thisPlugin, checkoutIntent, 1); // mpl_activity.startActivityForResult(checkoutIntent, 1); }