Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I think you didnot enter the appID and the server detail. Below is the working code which i have implement and It works fine for me. I have implement Pay on button click which extends the runnable</p> <pre><code> Check_out.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub if (_paypalLibraryInit) { showPayPalButton(); //Toast.makeText(Android_PP_Test1Activity.this, captions[position], Toast.LENGTH_SHORT).show(); } else { // Display a progress dialog to the user and start checking for when // the initialization is completed Thread initThread = new Thread(initLibraryRunnable); initThread.start(); _progressDialog = new ProgressDialog(Recharge.this); _progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER); _progressDialog.setMessage("Loading PayPal Payment Library"); _progressDialog.setCancelable(false); _progressDialog.show(); _progressDialogRunning = true; Thread newThread = new Thread(checkforPayPalInitRunnable); newThread.start(); //Toast.makeText(Android_PP_Test1Activity.this, "Picasso Paintings", Toast.LENGTH_SHORT).show(); } } }); </code></pre> <p>This button call this runnable method</p> <pre><code>//This lets us run the initLibrary function final Runnable initLibraryRunnable = new Runnable() { public void run() { initLibrary(); } }; </code></pre> <p>and this method is responsible to initiate the initLibrary.</p> <pre><code> /** init method **/ public void initLibrary() { PayPal pp = PayPal.getInstance(); 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. pp=PayPal.initWithAppID(this,"APP80W284485P519543T",PayPal.ENV_SANDBOX); // -- These are required settings. pp.setLanguage("en_US"); // Sets the language for the library. // -- // -- These are a few of the optional settings. // Sets the fees payer. If there are fees for the transaction, this // person will pay for them. Possible values are FEEPAYER_SENDER, // FEEPAYER_PRIMARYRECEIVER, FEEPAYER_EACHRECEIVER, and // FEEPAYER_SECONDARYONLY. pp.setFeesPayer(PayPal.FEEPAYER_EACHRECEIVER); // Set to true if the transaction will require shipping. pp.setShippingEnabled(true); // 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); // -- } } </code></pre> <p>Hope It helps...</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload