public void initLibrary() { PayPal pp = PayPal.getInstance(); if (pp == null) { // Test to see if the library is already initialized // This main initialization call takes your Context, AppID, and target server pp = PayPal.initWithAppID( this, "AZ2HgxDaSTTKy6ALdkinZ4GoOiwOgu9YlR3TDhcxiTU3XrDQLMRfbRvwAOLK", PayPal.ENV_LIVE); // Required settings: // Set the language for the library pp.setLanguage("en_US"); // Some Optional settings: // Sets who pays any transaction fees. Possible values are: // FEEPAYER_SENDER, FEEPAYER_PRIMARYRECEIVER, FEEPAYER_EACHRECEIVER, and // FEEPAYER_SECONDARYONLY pp.setFeesPayer(PayPal.FEEPAYER_EACHRECEIVER); // true = transaction requires shipping pp.setShippingEnabled(true); _paypalLibraryInit = true; } }
public void initLibrary() { PayPal pp = PayPal.getInstance(); if (pp == null) { // Test to see if the library is already initialized // This main initialization call takes your Context, AppID, and target server pp = PayPal.initWithAppID(getContext(), "APP-80W284485P519543T", PayPal.ENV_NONE); // Required settings: // Set the language for the library pp.setLanguage("en_US"); // Some Optional settings: // Sets who pays any transaction fees. Possible values are: // FEEPAYER_SENDER, FEEPAYER_PRIMARYRECEIVER, FEEPAYER_EACHRECEIVER, and // FEEPAYER_SECONDARYONLY pp.setFeesPayer(PayPal.FEEPAYER_EACHRECEIVER); // true = transaction requires shipping pp.setShippingEnabled(true); _paypalLibraryInit = true; } }
private boolean executeInitWithAppID(JSONArray inputs, CallbackContext callbackContext) { JSONObject args; // Get the input data. String strEnv = "ENV_NONE"; try { args = inputs.getJSONObject(0); this.appId = args.getString("appId"); strEnv = args.getString("appEnv"); } catch (JSONException exception) { Log.w(LOGTAG, String.format("Got JSON Exception: %s", exception.getMessage())); callbackContext.sendPluginResult(new PluginResult(Status.JSON_EXCEPTION)); return true; } if (strEnv.equals("ENV_LIVE")) { this.appEnv = PayPal.ENV_LIVE; } else if (strEnv.equals("ENV_SANDBOX")) { this.appEnv = PayPal.ENV_SANDBOX; } else { this.appEnv = PayPal.ENV_NONE; } Log.d(LOGTAG, "init paypal for " + this.appId + " with " + strEnv); PayPal.initWithAppID(cordova.getActivity(), this.appId, this.appEnv); callbackContext.sendPluginResult(new PluginResult(Status.OK)); return true; }
public void initLibrary() { PayPal pp = PayPal.getInstance(); if (pp == null) { pp = PayPal.initWithAppID(getActivity(), Util.sand_box_id, PayPal.ENV_SANDBOX); pp.setLanguage("en_US"); } }
/** * The initLibrary function takes care of all the basic Library initialization. * * @return The return will be true if the initialization was successful and false if */ private void initLibrary() { Log.i("mpl", "initLibrary"); PayPal pp = PayPal.getInstance(); // If the library is already initialized, then we don't need to // initialize it again. if (pp == null) { // This is the main initialization call that takes in your Context, // the Application ID, and the server you would like to connect to. try { pp = PayPal.initWithAppID(mpl_context, appID, server); } catch (IllegalStateException e) { throw new RuntimeException(e); } // -- These are required settings. if (mpjs_language.equals("")) pp.setLanguage("en_US"); // Sets the language for the library. else pp.setLanguage(mpjs_language); // Sets the language for the // library. // Set to true if the transaction will require shipping. if (mpjs_shipping.equals("1")) pp.setShippingEnabled(true); else pp.setShippingEnabled(false); // Dynamic Amount Calculation allows you to set tax and shipping // amounts based on the user's shipping address. Shipping must be // enabled for Dynamic Amount Calculation. This also requires you to // create a class that implements PaymentAdjuster and Serializable. // pp.setDynamicAmountCalculationEnabled(false); // -- } }