Thursday, 27 February 2014

How to Integrate WordPress with Your Website?

Introduction

By nature, WordPress is very powerful. It can be as complex or as simple as you wish. With that in mind, how much you want to use WordPress with your existing website is totally up to you. There may be only a few features of WordPress you want to use when integrating it with your site, or you may want your entire site run with WordPress. This tutorial will guide you through making your WordPress site look like your current design. We will start with how to make a WordPress blog look like the rest of your site. Then we can move on to making your entire site running on WordPress.
These directions will not work on a MultiSite Network.

Begin the transformation

First, assume you have an existing site at http://myexample.com. Next, create a new sub-directory (folder) at your site and call it 'blog' (you could use something other than blog, but you must create this sub-directory). So you now have an empty sub-directory at http://myexample.com/blog/. Now, download WordPress and upload all of its files into this new folder, and install Wordpress.

Grab the header

In order to transform regular PHP pages into ones that utilize WordPress, you need to add either of the following code snippets to the start of each page.
<?php 
/* Short and sweet */
define('WP_USE_THEMES', false);
require('./wp-blog-header.php');
?>
<?php
require('/the/path/to/your/wp-blog-header.php');
?>

The Loop

It is necessary to include The Loop in your pages to effectively take advantage of the multitude of Template Tags or plugins available. Familiarize yourself with The Loop and the basics of The Loop in Action to get underway with integrating the power of WordPress into your website.

Examples

Generate a list

In the event you want to show ten posts sorted alphabetically in ascending order on your web page, you could do the following to grab the posted date, title and excerpt:
<?php
require('/the/path/to/your/wp-blog-header.php');
?>

<?php
$posts = get_posts('numberposts=10&order=ASC&orderby=post_title');
foreach ($posts as $post) : setup_postdata( $post ); ?>
<?php the_date(); echo "<br />"; ?>
<?php the_title(); ?>    
<?php the_excerpt(); ?> 
<?php
endforeach;
?>

Last three posts

Display the last three posts on your web page.
// Get the last 3 posts.

<?php
global $post;
$args = array( 'posts_per_page' => 3 );
$myposts = get_posts( $args );
foreach( $myposts as $post ) : setup_postdata($post); ?>
<a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a><br />
<?php endforeach; ?>

Making a theme

The first portion of this tutorial described how to take components of WordPress and integrate them into your existing site. You may wish to stop right now, but perhaps you would like to create a WordPress theme that would eventually replace web pages on your site.
You will need to create a custom theme. A theme is a set of files used to tell WordPress how to display the site. Using_Themes. Go to your WordPress Themes folder (located at /wp-content/themes/) and create a new folder, call it "mytheme". This is where you will be adding files to control your site's look. You may wish to acquaint yourself with Theme_Development at this time. The basic theme files are index.phpstyle.csssingle.php, and comments.php.
A little known, but very helpful HTML element, <base> is going to help you out a lot. It instructs the browser to use a specified URL for relative paths:
 <base href="http://myexample.com" />
Normally, the <base> would be your current URL. For example, the default <base> at your blog will behttp://myexample.com/blog/. By changing it with the <base> element, you tell the browser to look for files athttp://myexample.com/. Why is this useful? When copying and pasting HTML from your current site, you will have references to something like:
 <img src="me.jpg" alt="" />
When you copy this HTML to your theme, the browser will be looking for http://myexample.com/blogs/me.jpg, when the file actually exists at http://myexample.com/me.jpg. Using <base href="http://myexample.com" />, the browser is told the right place to find the files and you do not have to edit every reference to every file that you copied from your main site.

Performance

Although WordPress is fast, it does contain a substantial quantity of code that needs to be loaded each time a page is displayed. This may or may not affect performance depending on the hosting environment, but on a shared hoasting environment using SuPhp (and thus without op code caching) it can add several seconds to each page load.

External links


Wednesday, 26 February 2014

PayPal Gateway Integration in ASP.NET ?

Introduction

If you are developing an ASP.NET web application and you require some payment gateway integration, then here is a simplified option to integrate PayPal with your application.
** A PayPal account can be used only for international transactions. You can not use it for domestic transactions. If you want the solution for domestic purpose then integrate CCAvenue or some other gateway, those provide domestic transactions.

Description

In this article I will explain thoroughly all the requirements and techniques for integrating PayPal in your web application.
Nowadays PayPal is the most popular payment gateway worldwide because it is totally free to integrate and PayPal does not charge anything for opening an account, you will pay PayPal when you get paid. And the amount is also lower than other payment gateways. 

Things to Do

First add a webform to your web application. Name it ProceedToPayment (as per your requirements). Then add the below shown div inside the form tag (where you want to put it).
In this div I have implemented all the details that a user should enter while making the payment, such as Name, Address, Subject, Mobile No, Email Address, Amount, Currency etc.

<div style="color: #324143; margin: 30px 0 0 60px; font-family: Arial;">
    <span style="font-size: small;">Your Name:</span>
    <asp:TextBox runat="server" ValidationGroup="save" ID="txtName" Style="margin-left: 30px; width: 200px;
        background-image: url('../images/txtBoxbg.jpg') no-repeat;"></asp:TextBox>
    <asp:RequiredFieldValidator ID="RequiredFieldValidator2" ControlToValidate="txtPurpose"
        ErrorMessage="Please enter your Name" runat="server" 
        ValidationGroup="save" ForeColor="red"></asp:RequiredFieldValidator>
    <br />
    <br />
    <span style="font-size: small;">Your Email Id:</span><asp:TextBox runat="server" ValidationGroup="save"
        Style="margin-left: 20px;width: 200px; background-image: url('../images/txtBoxbg.jpg') no-repeat;"
        ID="txtEmailId"></asp:TextBox>
    <asp:RegularExpressionValidator ID="regexEmailValid" runat="server" 
        ValidationExpression="\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"
        ControlToValidate="txtEmailId" ValidationGroup="save" 
        ErrorMessage="Invalid Email Format" 
        ForeColor="red"></asp:RegularExpressionValidator><br />
    <br />
    <span style="font-size: small;">Your Phone No:</span>
    <asp:TextBox runat="server" ID="txtPhone" ValidationGroup="save" Style="margin-left: 6px;
        width: 200px; background-image: transparent url('../images/txtBoxbg.jpg') no-repeat;"></asp:TextBox>
    <asp:RegularExpressionValidator ID="RegularExpressionValidator4" runat="server" ControlToValidate="txtPhone"
        ForeColor="red" ErrorMessage="Invalid Phone No"
        ValidationGroup="save" ValidationExpression="^([0-9\(\)\/\+ \-]*)$"></asp:RegularExpressionValidator>
    <br />
    <br />
    <span style="font-size: small;">Enter Amount:</span><asp:TextBox runat="server" ID="txtAmount" ValidationGroup="save"
        Style="margin-left: 16px; width: 200px; background-image: url('../images/txtBoxbg.jpg') no-repeat;"></asp:TextBox>
    <asp:RequiredFieldValidator ID="RequiredFieldValidator1" ControlToValidate="txtAmount"
        runat="server" ForeColor="red" ErrorMessage="Please enter the amount."></asp:RequiredFieldValidator>
    <br />
    <br />
    <span style="font-size: small;">Currency:</span>
    <asp:DropDownList runat="server" ID="ddlCurrency" Style="margin-left: 42px; 
        width: 204px; background-image: transparent url('../images/txtBoxbg.jpg') no-repeat;">
        <asp:ListItem>- Select -</asp:ListItem>
        <asp:ListItem>INR</asp:ListItem>
        <asp:ListItem>USD</asp:ListItem>
        <asp:ListItem>EURO</asp:ListItem>
        <asp:ListItem>Pound</asp:ListItem>
    </asp:DropDownList>
    <br />
    <br />
    <span style="font-size: small;">Your Purpose:</span><asp:TextBox TextMode="MultiLine" 
        Rows="10" runat="server" ID="txtPurpose"
        Height="50px" 
        Style="margin-left: 17px; margin-left: 19px; width: 200px; 
               background-image: url('../images/txtBoxbg.jpg') no-repeat;"></asp:TextBox>
    <asp:RequiredFieldValidator ID="RequiredFieldValidator6" ControlToValidate="txtPurpose"
        ErrorMessage="Can not be left blank" ValidationGroup="save" 
        runat="server" ForeColor="red"></asp:RequiredFieldValidator>
    <br />
    <asp:Button ID="btnPay" runat="server" Text="Pay Now" CssClass="button" Style="font-size: 12px;
        cursor: pointer; height: 27px; margin-left: 207px; margin-top: 10px; width: 93px;"
        OnClick="btnPay_AsPerYourChoice" ValidationGroup="save"></asp:Button>
</div>

Now go to the code behind page of the webform and add the below method in it.
An important thing to notice is I am using the live URL of PayPal as this functionality is implemented in my live server. You can use the Sandbox URL of PayPal for testing purposes.
protected void PayWithPayPal(string amount, string itemInfo, string name, 
          string phone, string email, string currency)
{
    string redirecturl = "";

    //Mention URL to redirect content to paypal site
    redirecturl += "https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=" + 
                   ConfigurationManager.AppSettings["paypalemail"].ToString();

    //First name i assign static based on login details assign this value
    redirecturl += "&first_name=" + name;

    //City i assign static based on login user detail you change this value
    redirecturl += "&city=bhubaneswar";

    //State i assign static based on login user detail you change this value
    redirecturl += "&state=Odisha";

    //Product Name
    redirecturl += "&item_name=" + itemInfo;

    //Product Name
    redirecturl += "&amount=" + amount;

    //Phone No
    redirecturl += "&night_phone_a=" + phone;

    //Product Name
    redirecturl += "&item_name=" + itemInfo;

    //Address 
    redirecturl += "&address1=" + email;

    //Business contact id
    // redirecturl += "&business=k.tapankumar@gmail.com";

    //Shipping charges if any
    redirecturl += "&shipping=0";

    //Handling charges if any
    redirecturl += "&handling=0";

    //Tax amount if any
    redirecturl += "&tax=0";

    //Add quatity i added one only statically 
    redirecturl += "&quantity=1";

    //Currency code 
    redirecturl += "&currency=" + currency;

    //Success return page url
    redirecturl += "&return=" + 
      ConfigurationManager.AppSettings["SuccessURL"].ToString();

    //Failed return page url
    redirecturl += "&cancel_return=" + 
      ConfigurationManager.AppSettings["FailedURL"].ToString();

    Response.Redirect(redirecturl);
}
OK, that is fine. Now before running your application you need to add something in your web.config file.
Just add the below shown appsetting code snippet to your web config file under the system.web tag.
Here you have to give information regarding your PayPal account, your PayPal email ID , PayPal submit URL, your website success URL, failure URL, etc.
<appSettings>
    <add key="token" value="PW1BDVNqVPVanwduF_Tb2Ey91aT1Uhx1kL7HPc-7e8S-6AnUwSSHyasolSe"/>
    <add key="paypalemail" value="k.tapankumar@gmail.com"/>

    <!--Here i used sandbox site url only if you hosted in live change sandbox to live paypal URL-->
    <add key="PayPalSubmitUrl" value="https://www.paypal.com/cgi-bin/webscr"/>

    <add key="FailedURL" value="http://www.mrsoft.co.in/ProceedToPayment.aspx"/>

    <add key="SuccessURL" value="http://www.mrsoft.co.in/ProceedToPayment.aspx"/>

</appSettings>

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

How to Integrate PayPal with Android Applications?

check how to PayPal integrate with Android applications.

           

(1) create account in sandbox environment:
   
    Go to this link-Here
  
    In website go to test account tab and create your desired account
        here three types of account is available
        (1)Personal   [For individuals who shop online]
        (2)Business   [For merchants who use a company or group name]
        (3)Premier    [For individuals who buy and sell on-line ]
      
        create one personal and one Business account for testing transaction
      
        for personal account id is something like
        this ==>> xxxxabc@gmail.com

        for business account id is something
        like this ==>> xxxbus@gmail.com
   Now i hope you have created two account ....lets move to second Step

   (2) download paypal library for android and add it to project
         you can download paypal library from here

   (3) test the below code with some modification
package com.paypal.android.simpledemo;

import java.math.BigDecimal;

import android.app.Activity;
import android.content.Intent;
import android.graphics.Color;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.view.Gravity;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.ScrollView;
import android.widget.TextView;
import android.widget.FrameLayout.LayoutParams;

import com.paypal.android.MEP.CheckoutButton;
import com.paypal.android.MEP.PayPal;
import com.paypal.android.MEP.PayPalAdvancedPayment;
import com.paypal.android.MEP.PayPalInvoiceData;
import com.paypal.android.MEP.PayPalInvoiceItem;
import com.paypal.android.MEP.PayPalPayment;
import com.paypal.android.MEP.PayPalPreapproval;
import com.paypal.android.MEP.PayPalReceiverDetails;

public class SimpleDemo extends Activity implements OnClickListener {
 
 // The PayPal server to be used - can also be ENV_NONE and ENV_LIVE
 private static final int server = PayPal.ENV_SANDBOX;
 // The ID of your application that you received from PayPal
 private static final String appID = "APP-80W284485P519543T";
 // This is passed in for the startActivityForResult() android function, the value used is up to you
 private static final int request = 1;
 
 public static final String build = "10.12.09.8053";
 
 protected static final int INITIALIZE_SUCCESS = 0;
 protected static final int INITIALIZE_FAILURE = 1;

 // Native android items for the application
 ScrollView scroller;
 TextView labelSimplePayment;
 TextView labelParallelPayment;
 TextView labelChainedPayment;
 TextView labelPreapproval;
 TextView labelKey;
 TextView appVersion;
 EditText enterPreapprovalKey;
 Button exitApp;
 TextView title;
 TextView info;
 TextView extra;
 LinearLayout layoutSimplePayment;
 LinearLayout layoutSplitPayment;
 LinearLayout layoutChainedPayment;
 LinearLayout layoutPreapproval;
 
 // You will need at least one CheckoutButton, this application has four for examples
 CheckoutButton launchSimplePayment;
 CheckoutButton launchParallelPayment;
 CheckoutButton launchChainedPayment;
 CheckoutButton launchPreapproval;
 
 // These are used to display the results of the transaction
 public static String resultTitle;
 public static String resultInfo;
 public static String resultExtra;
 
 // This handler will allow us to properly update the UI. You cannot touch Views from a non-UI thread.
 Handler hRefresh = new Handler(){
  @Override
  public void handleMessage(Message msg) {
   switch(msg.what){
       case INITIALIZE_SUCCESS:
        setupButtons();
              break;
       case INITIALIZE_FAILURE:
        showFailure();
        break;
   }
  }
 };

 
 public void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  
  // Initialize the library. We'll do it in a separate thread because it requires communication with the server
  // which may take some time depending on the connection strength/speed.
  Thread libraryInitializationThread = new Thread() {
   public void run() {
    initLibrary();
    
    // The library is initialized so let's create our CheckoutButton and update the UI.
    if (PayPal.getInstance().isLibraryInitialized()) {
     hRefresh.sendEmptyMessage(INITIALIZE_SUCCESS);
    }
    else {
     hRefresh.sendEmptyMessage(INITIALIZE_FAILURE);
    }
   }
  };
  libraryInitializationThread.start();
  
  // Setup our UI.
  scroller = new ScrollView(this);
  scroller.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
  scroller.setBackgroundColor(Color.BLACK);
  
  LinearLayout content = new LinearLayout(this);
  content.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
  content.setGravity(Gravity.CENTER_HORIZONTAL);
  content.setOrientation(LinearLayout.VERTICAL);
  content.setPadding(10, 10, 10, 10);
  content.setBackgroundColor(Color.TRANSPARENT);
  
  layoutSimplePayment = new LinearLayout(this);
  layoutSimplePayment.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
  layoutSimplePayment.setGravity(Gravity.CENTER_HORIZONTAL);
  layoutSimplePayment.setOrientation(LinearLayout.VERTICAL);
  layoutSimplePayment.setPadding(0, 5, 0, 5);
   
  labelSimplePayment = new TextView(this);
  labelSimplePayment.setGravity(Gravity.CENTER_HORIZONTAL);
  labelSimplePayment.setText("Simple Payment:");
  layoutSimplePayment.addView(labelSimplePayment);
  labelSimplePayment.setVisibility(View.GONE);
   
  content.addView(layoutSimplePayment);
   
  layoutSplitPayment = new LinearLayout(this);
  layoutSplitPayment.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
  layoutSplitPayment.setGravity(Gravity.CENTER_HORIZONTAL);
  layoutSplitPayment.setOrientation(LinearLayout.VERTICAL);
  layoutSplitPayment.setPadding(0, 5, 0, 5);
   
  labelParallelPayment = new TextView(this);
  labelParallelPayment.setGravity(Gravity.CENTER_HORIZONTAL);
  labelParallelPayment.setText("Parallel Payment:");
  layoutSplitPayment.addView(labelParallelPayment);
  labelParallelPayment.setVisibility(View.GONE);
   
  content.addView(layoutSplitPayment);
   
  layoutChainedPayment = new LinearLayout(this);
  layoutChainedPayment.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
  layoutChainedPayment.setGravity(Gravity.CENTER_HORIZONTAL);
  layoutChainedPayment.setOrientation(LinearLayout.VERTICAL);
  layoutChainedPayment.setPadding(0, 5, 0, 5);
   
  labelChainedPayment = new TextView(this);
  labelChainedPayment.setGravity(Gravity.CENTER_HORIZONTAL);
  labelChainedPayment.setText("Chained Payment:");
  layoutChainedPayment.addView(labelChainedPayment);
  labelChainedPayment.setVisibility(View.GONE);
   
  content.addView(layoutChainedPayment);
   
  layoutPreapproval = new LinearLayout(this);
  layoutPreapproval.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
  layoutPreapproval.setGravity(Gravity.CENTER_HORIZONTAL);
  layoutPreapproval.setOrientation(LinearLayout.VERTICAL);
  layoutPreapproval.setPadding(0, 5, 0, 1);
   
  labelPreapproval = new TextView(this);
  labelPreapproval.setGravity(Gravity.CENTER_HORIZONTAL);
  labelPreapproval.setText("Preapproval:");
  layoutPreapproval.addView(labelPreapproval);
  labelPreapproval.setVisibility(View.GONE);
   
  content.addView(layoutPreapproval);
   
  LinearLayout layoutKey = new LinearLayout(this);
  layoutKey.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
  layoutKey.setGravity(Gravity.CENTER_HORIZONTAL);
  layoutKey.setOrientation(LinearLayout.VERTICAL);
  layoutKey.setPadding(0, 1, 0, 5);
   
  enterPreapprovalKey = new EditText(this);
  enterPreapprovalKey.setLayoutParams(new LayoutParams(200, 45));
  enterPreapprovalKey.setGravity(Gravity.CENTER);
  enterPreapprovalKey.setSingleLine(true);
  enterPreapprovalKey.setHint("Enter PA Key");
  layoutKey.addView(enterPreapprovalKey);
  enterPreapprovalKey.setVisibility(View.GONE);
  labelKey = new TextView(this);
  labelKey.setGravity(Gravity.CENTER_HORIZONTAL);
  labelKey.setPadding(0, -5, 0, 0);
  labelKey.setText("(Required for Preapproval)");
  layoutKey.addView(labelKey);
  labelKey.setVisibility(View.GONE);
  content.addView(layoutKey);
   
  title = new TextView(this);
  title.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));
  title.setPadding(0, 5, 0, 5);
  title.setGravity(Gravity.CENTER_HORIZONTAL);
  title.setTextSize(30.0f);
  title.setVisibility(TextView.GONE);
  content.addView(title);
   
  info = new TextView(this);
  info.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));
  info.setPadding(0, 5, 0, 5);
  info.setGravity(Gravity.CENTER_HORIZONTAL);
  info.setTextSize(20.0f);
  info.setVisibility(TextView.VISIBLE);
  info.setText("Initializing Library...");
  content.addView(info);
   
  extra = new TextView(this);
  extra.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));
  extra.setPadding(0, 5, 0, 5);
  extra.setGravity(Gravity.CENTER_HORIZONTAL);
  extra.setTextSize(12.0f);
  extra.setVisibility(TextView.GONE);
  content.addView(extra);
  
  LinearLayout layoutExit = new LinearLayout(this);
  layoutExit.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
  layoutExit.setGravity(Gravity.CENTER_HORIZONTAL);
  layoutExit.setOrientation(LinearLayout.VERTICAL);
  layoutExit.setPadding(0, 15, 0, 5);
  
  exitApp = new Button(this);
  exitApp.setLayoutParams(new LayoutParams(200, LayoutParams.WRAP_CONTENT)); //Semi mimic PP button sizes
  exitApp.setOnClickListener(this);
  exitApp.setText("Exit");
  layoutExit.addView(exitApp);
  content.addView(layoutExit);
  
  appVersion = new TextView(this);
  appVersion.setGravity(Gravity.CENTER_HORIZONTAL);
  appVersion.setPadding(0, -5, 0, 0);
  appVersion.setText("\n\nSimple Demo Build " + build + "\nMPL Library Build " + PayPal.getBuild());
  content.addView(appVersion);
  appVersion.setVisibility(View.GONE);
  
  scroller.addView(content);
  setContentView(scroller);
 }
 
 /**
  * Create our CheckoutButton and update the UI.
  */
 public void setupButtons() {
  PayPal pp = PayPal.getInstance();
  // Get the CheckoutButton. There are five different sizes. The text on the button can either be of type TEXT_PAY or TEXT_DONATE.
  launchSimplePayment = pp.getCheckoutButton(this, PayPal.BUTTON_194x37, CheckoutButton.TEXT_PAY);
  // You'll need to have an OnClickListener for the CheckoutButton. For this application, MPL_Example implements OnClickListener and we
  // have the onClick() method below.
  launchSimplePayment.setOnClickListener(this);
  // The CheckoutButton is an android LinearLayout so we can add it to our display like any other View.
  layoutSimplePayment.addView(launchSimplePayment);
  
  // Get the CheckoutButton. There are five different sizes. The text on the button can either be of type TEXT_PAY or TEXT_DONATE.
  launchParallelPayment = pp.getCheckoutButton(this, PayPal.BUTTON_194x37, CheckoutButton.TEXT_PAY);
  // You'll need to have an OnClickListener for the CheckoutButton. For this application, MPL_Example implements OnClickListener and we
  // have the onClick() method below.
  launchParallelPayment.setOnClickListener(this);
  // The CheckoutButton is an android LinearLayout so we can add it to our display like any other View.
  layoutSplitPayment.addView(launchParallelPayment);
  
  // Get the CheckoutButton. There are five different sizes. The text on the button can either be of type TEXT_PAY or TEXT_DONATE.
  launchChainedPayment = pp.getCheckoutButton(this, PayPal.BUTTON_194x37, CheckoutButton.TEXT_PAY);
  // You'll need to have an OnClickListener for the CheckoutButton. For this application, MPL_Example implements OnClickListener and we
  // have the onClick() method below.
  launchChainedPayment.setOnClickListener(this);
  // The CheckoutButton is an android LinearLayout so we can add it to our display like any other View.
  layoutChainedPayment.addView(launchChainedPayment);
  
  // Get the CheckoutButton. There are five different sizes. The text on the button can either be of type TEXT_PAY or TEXT_DONATE.
  launchPreapproval = pp.getCheckoutButton(this, PayPal.BUTTON_194x37, CheckoutButton.TEXT_PAY);
  // You'll need to have an OnClickListener for the CheckoutButton. For this application, MPL_Example implements OnClickListener and we
  // have the onClick() method below.
  launchPreapproval.setOnClickListener(this);
  // The CheckoutButton is an android LinearLayout so we can add it to our display like any other View.
  layoutPreapproval.addView(launchPreapproval);
  
  // Show our labels and the preapproval EditText.
  labelSimplePayment.setVisibility(View.VISIBLE);
  labelParallelPayment.setVisibility(View.VISIBLE);
  labelChainedPayment.setVisibility(View.VISIBLE);
  labelPreapproval.setVisibility(View.VISIBLE);
  enterPreapprovalKey.setVisibility(View.VISIBLE);
  labelKey.setVisibility(View.VISIBLE);
  appVersion.setVisibility(View.VISIBLE);
  
  info.setText("");
  info.setVisibility(View.GONE);
 }
 
 /**
  * Show a failure message because initialization failed.
  */
 public void showFailure() {
  title.setText("FAILURE");
  info.setText("Could not initialize the PayPal library.");
  title.setVisibility(View.VISIBLE);
  info.setVisibility(View.VISIBLE);
 }
 
 /**
  * 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() {
  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.
   pp = PayPal.initWithAppID(this, appID, server);
      
   // -- 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);
         // --
  }
 }
 
 /**
  * Create a PayPalPayment which is used for simple payments.
  * 
  * @return Returns a PayPalPayment. 
  */
 private PayPalPayment exampleSimplePayment() {
  // Create a basic PayPalPayment.
  PayPalPayment payment = new PayPalPayment();
  // Sets the currency type for this payment.
     payment.setCurrencyType("USD");
     // Sets the recipient for the payment. This can also be a phone number.
     payment.setRecipient("example-merchant-1@paypal.com");
     // Sets the amount of the payment, not including tax and shipping amounts.
     payment.setSubtotal(new BigDecimal("8.25"));
     // Sets the payment type. This can be PAYMENT_TYPE_GOODS, PAYMENT_TYPE_SERVICE, PAYMENT_TYPE_PERSONAL, or PAYMENT_TYPE_NONE.
     payment.setPaymentType(PayPal.PAYMENT_TYPE_GOODS);
     
     // PayPalInvoiceData can contain tax and shipping amounts. It also contains an ArrayList of PayPalInvoiceItem which can
     // be filled out. These are not required for any transaction.
     PayPalInvoiceData invoice = new PayPalInvoiceData();
     // Sets the tax amount.
     invoice.setTax(new BigDecimal("1.25"));
     // Sets the shipping amount.
     invoice.setShipping(new BigDecimal("4.50"));
     
     // PayPalInvoiceItem has several parameters available to it. None of these parameters is required.
     PayPalInvoiceItem item1 = new PayPalInvoiceItem();
     // Sets the name of the item.
     item1.setName("Pink Stuffed Bunny");
     // Sets the ID. This is any ID that you would like to have associated with the item.
     item1.setID("87239");
     // Sets the total price which should be (quantity * unit price). The total prices of all PayPalInvoiceItem should add up
     // to less than or equal the subtotal of the payment.
     item1.setTotalPrice(new BigDecimal("6.00"));
     // Sets the unit price.
     item1.setUnitPrice(new BigDecimal("2.00"));
     // Sets the quantity.
     item1.setQuantity(3);
     // Add the PayPalInvoiceItem to the PayPalInvoiceData. Alternatively, you can create an ArrayList
     // and pass it to the PayPalInvoiceData function setInvoiceItems().
     invoice.getInvoiceItems().add(item1);
     
     // Create and add another PayPalInvoiceItem to add to the PayPalInvoiceData.
     PayPalInvoiceItem item2 = new PayPalInvoiceItem();
     item2.setName("Well Wishes");
     item2.setID("56691");
     item2.setTotalPrice(new BigDecimal("2.25"));
     item2.setUnitPrice(new BigDecimal("0.25"));
     item2.setQuantity(9);
     invoice.getInvoiceItems().add(item2);
     
     // Sets the PayPalPayment invoice data.
     payment.setInvoiceData(invoice);
     // Sets the merchant name. This is the name of your Application or Company.
     payment.setMerchantName("The Gift Store");
     // Sets the description of the payment.
     payment.setDescription("Quite a simple payment");
     // Sets the Custom ID. This is any ID that you would like to have associated with the payment.
     payment.setCustomID("8873482296");
     // Sets the Instant Payment Notification url. This url will be hit by the PayPal server upon completion of the payment.
     payment.setIpnUrl("http://www.exampleapp.com/ipn");
     // Sets the memo. This memo will be part of the notification sent by PayPal to the necessary parties.
     payment.setMemo("Hi! I'm making a memo for a simple payment.");
     
     return payment;
 }
 
 /**
  * Create a PayPalAdvancedPayment is setup to be a parallel payment.
  * 
  * @return Returns a PayPalAdvancedPayment.
  */
 private PayPalAdvancedPayment exampleParallelPayment() {
  // Create the PayPalAdvancedPayment.
  PayPalAdvancedPayment payment = new PayPalAdvancedPayment();
  // Sets the currency type for this payment.
     payment.setCurrencyType("USD");
     // Sets the Instant Payment Notification url. This url will be hit by the PayPal server upon completion of the payment.
     payment.setIpnUrl("http://www.exampleapp.com/ipn");
     // Sets the memo. This memo will be part of the notification sent by PayPal to the necessary parties.
     payment.setMemo("This sure is a swell memo for a parallel payment.");
     
     // Create the PayPalReceiverDetails. You must have at least one of these to make an advanced payment and you should have
     // more than one for a Parallel or Chained payment.
  PayPalReceiverDetails receiver1 = new PayPalReceiverDetails();
  // Sets the recipient for the PayPalReceiverDetails. This can also be a phone number.
  receiver1.setRecipient("example-merchant-2@paypal.com");
  // Sets the subtotal of the payment for this receiver, not including tax and shipping amounts. 
  receiver1.setSubtotal(new BigDecimal("13.50"));
  // Sets the primary flag for this receiver. This is defaulted to false. No receiver can be a primary for a parallel payment.
  receiver1.setIsPrimary(false);
  // Sets the payment type. This can be PAYMENT_TYPE_GOODS, PAYMENT_TYPE_SERVICE, PAYMENT_TYPE_PERSONAL, or PAYMENT_TYPE_NONE.
  receiver1.setPaymentType(PayPal.PAYMENT_TYPE_GOODS);
  
  // PayPalInvoiceData can contain tax and shipping amounts. It also contains an ArrayList of PayPalInvoiceItem which can
     // be filled out. These are not required for any transaction.
  PayPalInvoiceData invoice1 = new PayPalInvoiceData();
  // Sets the tax amount.
  invoice1.setTax(new BigDecimal("2.20"));
  // Sets the shipping amount.
  invoice1.setShipping(BigDecimal.ZERO);
  
  // PayPalInvoiceItem has several parameters available to it. None of these parameters is required.
  PayPalInvoiceItem item1 = new PayPalInvoiceItem();
  // Sets the name of the item.
     item1.setName("Laser Show");(1) create account in sandbox environment:
     // Sets the ID. This is any ID that you would like to have associated with the item.
     item1.setID("4211");
     // Sets the total price which should be (quantity * unit price). The total prices of all PayPalInvoiceItem should add up
     // to less than or equal the subtotal of the payment.
     item1.setTotalPrice(new BigDecimal("7.30"));
     // Sets the unit price.
     item1.setUnitPrice(new BigDecimal("7.30"));
     // Sets the quantity.
     item1.setQuantity(1);
     // Add the PayPalInvoiceItem to the PayPalInvoiceData. Alternatively, you can create an ArrayList
     // and pass it to the PayPalInvoiceData function setInvoiceItems().
     invoice1.getInvoiceItems().add(item1);
     
     // Create and add another PayPalInvoiceItem to add to the PayPalInvoiceData.
  PayPalInvoiceItem item2 = new PayPalInvoiceItem();
     item2.setName("Fog Machine");
     item2.setID("6325");
     item2.setTotalPrice(new BigDecimal("4.80"));
     item2.setUnitPrice(new BigDecimal("1.20"));
     item2.setQuantity(4);
     invoice1.getInvoiceItems().add(item2);
     
     // Create and add another PayPalInvoiceItem to add to the PayPalInvoiceData.
  PayPalInvoiceItem item3 = new PayPalInvoiceItem();
     item3.setName("Fog Liquid");
     item3.setID("2196");
     item3.setTotalPrice(new BigDecimal("1.40"));
     item3.setUnitPrice(new BigDecimal("0.20"));
     item3.setQuantity(7);
     invoice1.getInvoiceItems().add(item3);
  
     // Sets the PayPalReceiverDetails invoice data.
     receiver1.setInvoiceData(invoice1);
     // Sets the merchant name. This is the name of your Application or Company.
     receiver1.setMerchantName("Laser Shop");
     // Sets the description of the payment.
     receiver1.setDescription("The first of two party guys");
     // Sets the Custom ID. This is any ID that you would like to have associated with the PayPalReceiverDetails.
     receiver1.setCustomID("001813");
     // Add the receiver to the payment. Alternatively, you can create an ArrayList
     // and pass it to the PayPalAdvancedPayment function setReceivers().
  payment.getReceivers().add(receiver1);
     
     // Create another receiver for the parallel payment
  PayPalReceiverDetails receiver2 = new PayPalReceiverDetails();
  receiver2.setRecipient("example-merchant-3@paypal.com");
  receiver2.setSubtotal(new BigDecimal("16.00"));
  receiver2.setIsPrimary(false);
  receiver2.setPaymentType(PayPal.PAYMENT_TYPE_GOODS);
  
  // PayPalInvoiceData can contain tax and shipping amounts. It also contains an ArrayList of PayPalInvoiceItem which can
     // be filled out. These are not required for any transaction.
  PayPalInvoiceData invoice2 = new PayPalInvoiceData();
  // Sets the tax amount.
  invoice2.setTax(new BigDecimal("3.40"));
  // Sets the shipping amount.
  invoice2.setShipping(new BigDecimal("5.15"));
  
  // PayPalInvoiceItem has several parameters available to it. None of these parameters is required.
  PayPalInvoiceItem item4 = new PayPalInvoiceItem();
  // Sets the name of the item.
     item4.setName("Beverages");
     // Sets the ID. This is any ID that you would like to have associated with the item.
     item4.setID("7254");
     // Sets the total price which should be (quantity * unit price). The total prices of all PayPalInvoiceItem should add up
     // to less than or equal the subtotal of the payment.
     item4.setTotalPrice(new BigDecimal("11.00"));
     // Sets the unit price.
     item4.setUnitPrice(new BigDecimal("1.00"));
     // Sets the quantity.
     item4.setQuantity(11);
     // Add the PayPalInvoiceItem to the PayPalInvoiceData. Alternatively, you can create an ArrayList
     // and pass it to the PayPalInvoiceData function setInvoiceItems().
     invoice2.getInvoiceItems().add(item4);
     
     // Create and add another PayPalInvoiceItem to add to the PayPalInvoiceData.
  PayPalInvoiceItem item5 = new PayPalInvoiceItem();
     item5.setName("Refreshments");
     item5.setID("1288");
     item5.setTotalPrice(new BigDecimal("5.00"));
     item5.setUnitPrice(new BigDecimal("1.25"));
     item5.setQuantity(4);
     invoice2.getInvoiceItems().add(item5);
         
     // Sets the PayPalReceiverDetails invoice data.
     receiver2.setInvoiceData(invoice2);
     // Sets the merchant name. This is the name of your Application or Company.
     receiver2.setMerchantName("Drinks & Refreshments");
     // Sets the description of the payment.
     receiver2.setDescription("The second of two party guys");
     // Sets the Custom ID. This is any ID that you would like to have associated with the PayPalReceiverDetails.
     receiver2.setCustomID("001768");
  payment.getReceivers().add(receiver2);

  return payment;
 }
 
 /**
  * Creates a PayPalAdvancedPayment which is setup to be a chained payment.
  * 
  * @return Returns a PayPalAdvancedPayment.
  */
 private PayPalAdvancedPayment exampleChainedPayment() {
  // Create the PayPalAdvancedPayment.
  PayPalAdvancedPayment payment = new PayPalAdvancedPayment();
  // Sets the currency type for this payment.
     payment.setCurrencyType("USD");
     // Sets the Instant Payment Notification url. This url will be hit by the PayPal server upon completion of the payment.
     payment.setIpnUrl("http://www.exampleapp.com/ipn");
     // Sets the memo. This memo will be part of the notification sent by PayPal to the necessary parties.
     payment.setMemo("Yarr, a memo for chained payments, this be.");
     
     // Create the PayPalReceiverDetails. You must have at least one of these to make an advanced payment and you should have
     // more than one for a Parallel or Chained payment.
  PayPalReceiverDetails receiver1 = new PayPalReceiverDetails();
  // Sets the recipient for the PayPalReceiverDetails. This can also be a phone number.
  receiver1.setRecipient("example-merchant-1@paypal.com");
  // Sets the subtotal of the payment for this receiver, not including tax and shipping amounts.
  receiver1.setSubtotal(new BigDecimal("15.00"));
  // Sets the primary flag for the receiver. One receiver must be a primary to create a Chained payment.
  receiver1.setIsPrimary(true);
  // Sets the payment type. This can be PAYMENT_TYPE_GOODS, PAYMENT_TYPE_SERVICE, PAYMENT_TYPE_PERSONAL, or PAYMENT_TYPE_NONE.
  receiver1.setPaymentType(PayPal.PAYMENT_TYPE_GOODS);
  
  // PayPalInvoiceData can contain tax and shipping amounts. It also contains an ArrayList of PayPalInvoiceItem which can
     // be filled out. These are not required for any transaction.
  PayPalInvoiceData invoice1 = new PayPalInvoiceData();
  // Sets the tax amount.
  invoice1.setTax(new BigDecimal("1.50"));
  // Sets the shipping amount.
  invoice1.setShipping(new BigDecimal("3.50"));
  
  // PayPalInvoiceItem has several parameters available to it. None of these parameters is required.
  PayPalInvoiceItem item1 = new PayPalInvoiceItem();
  // Sets the name of the item.
     item1.setName("Boat Tickets");
     // Sets the ID. This is any ID that you would like to have associated with the item.
     item1.setID("29463");
     // Sets the total price which should be (quantity * unit price). The total prices of all PayPalInvoiceItem should add up
     // to less than or equal the subtotal of the payment.
     item1.setTotalPrice(new BigDecimal("15.00"));
     // Sets the unit price.
     item1.setUnitPrice(new BigDecimal("3.00"));
     // Sets the quantity.
     item1.setQuantity(5);
     // Add the PayPalInvoiceItem to the PayPalInvoiceData. Alternatively, you can create an ArrayList
     // and pass it to the PayPalInvoiceData function setInvoiceItems().
     invoice1.getInvoiceItems().add(item1);
  
     // Sets the PayPalReceiverDetails invoice data.
     receiver1.setInvoiceData(invoice1);
     // Sets the merchant name. This is the name of your Application or Company.
     receiver1.setMerchantName("Boating Inc.");
     // Sets the description of the payment.
     receiver1.setDescription("A chain payment primary");
     // Sets the Custom ID. This is any ID that you would like to have associated with the PayPalReceiverDetails.
     receiver1.setCustomID("55342");
     // Add the receiver to the payment. Alternatively, you can create an ArrayList
     // and pass it to the PayPalAdvancedPayment function setReceivers().
  payment.getReceivers().add(receiver1);
     
  // Create another receiver for the chained payment
  PayPalReceiverDetails receiver2 = new PayPalReceiverDetails();
  receiver2.setRecipient("example-merchant-2@paypal.com");
  receiver2.setSubtotal(new BigDecimal("6.00"));
  receiver2.setIsPrimary(false);
  receiver2.setPaymentType(PayPal.PAYMENT_TYPE_GOODS);
  receiver2.setMerchantName("Ticket Source Junior");
  receiver2.setDescription("One of the chain payment secondaries");
     receiver2.setCustomID("93675");
  payment.getReceivers().add(receiver2);
  
  // Create another receiver for the chained payment
  PayPalReceiverDetails receiver3 = new PayPalReceiverDetails();
  receiver3.setRecipient("example-merchant-3@paypal.com");
  receiver3.setSubtotal(new BigDecimal("7.00"));
  receiver3.setIsPrimary(false);
  receiver3.setPaymentType(PayPal.PAYMENT_TYPE_GOODS);
  receiver3.setMerchantName("Ticket Source Senior");
  receiver3.setDescription("One of the chain payment secondaries");
     receiver3.setCustomID("78853");
  payment.getReceivers().add(receiver3);

  return payment;
 }
 
 /**
  * Creates a PayPalPreapproval.
  * 
  * @return Returns a PayPalPreapproval.
  */
 private PayPalPreapproval examplePreapproval() {
  // Create the PayPalPreapproval
     PayPalPreapproval preapproval = new PayPalPreapproval();
     // Sets the currency type for this payment.
     preapproval.setCurrencyType("USD");
     // Sets the Instant Payment Notification url. This url will be hit by the PayPal server upon completion of the payment.
     preapproval.setIpnUrl("http://www.exampleapp.com/ipn");
     // Sets the memo. This memo will be part of the notification sent by PayPal to the necessary parties.
     preapproval.setMemo("Why hello, and welcome to the preapproval memo.");
     // Sets the merchant name. This is the name of your Application or Company.
     preapproval.setMerchantName("Joe's Bear Emporium");

  return preapproval;
 }

 public void onClick(View v) {
  
  /**
   * For each call to checkout() and preapprove(), we pass in a ResultDelegate. If you want your application
   * to be notified as soon as a payment is completed, then you need to create a delegate for your application.
   * The delegate will need to implement PayPalResultDelegate and Serializable. See our ResultDelegate for
   * more details.
   */  
  
  if(v == launchSimplePayment) {
   // Use our helper function to create the simple payment.
   PayPalPayment payment = exampleSimplePayment(); 
   // Use checkout to create our Intent.
   Intent checkoutIntent = PayPal.getInstance().checkout(payment, this, new ResultDelegate());
   // Use the android's startActivityForResult() and pass in our Intent. This will start the library.
      startActivityForResult(checkoutIntent, request);
  } else if(v == launchParallelPayment) {
   // Use our helper function to create the parallel payment.
      PayPalAdvancedPayment payment = exampleParallelPayment();
      // Use checkout to create our Intent.
      Intent checkoutIntent = PayPal.getInstance().checkout(payment, this, new ResultDelegate());
      // Use the android's startActivityForResult() and pass in our Intent. This will start the library.
      startActivityForResult(checkoutIntent, request);
  } else if(v == launchChainedPayment) {
   // Use our helper function to create the chained payment.
      PayPalAdvancedPayment payment = exampleChainedPayment();
      // Use checkout to create our Intent.
      Intent checkoutIntent = PayPal.getInstance().checkout(payment, this, new ResultDelegate());
      // Use the android's startActivityForResult() and pass in our Intent. This will start the library.
      startActivityForResult(checkoutIntent, request);
  } else if(v == launchPreapproval) {
   // Use our helper function to create the preapproval.
   PayPalPreapproval preapproval = examplePreapproval();
   // Set our preapproval key. In order to start a preapproval, you will need a preapproval key.  In order to
   // get this key, you will need to make a call externally to the library. Our application uses a simple
   // EditText for the key to be entered into.
   PayPal.getInstance().setPreapprovalKey(enterPreapprovalKey.getText().toString());
   // Use peapprove to create our Intent.
   Intent preapproveIntent = PayPal.getInstance().preapprove(preapproval, this, new ResultDelegate());
   // Use the android's startActivityForResult() and pass in our Intent. This will start the library.
   startActivityForResult(preapproveIntent, request);
  } else if(v == exitApp) {
   // The exit button was pressed, so close the application.
   finish();
  }
 }
 
 public void onActivityResult(int requestCode, int resultCode, Intent data) {
     if(requestCode != request)
      return;
     
     /**
      * If you choose not to implement the PayPalResultDelegate, then you will receive the transaction results here.
      * Below is a section of code that is commented out. This is an example of how to get result information for
      * the transaction. The resultCode will tell you how the transaction ended and other information can be pulled
      * from the Intent using getStringExtra.
      */
     /*switch(resultCode) {
  case Activity.RESULT_OK:
   resultTitle = "SUCCESS";
   resultInfo = "You have successfully completed this " + (isPreapproval ? "preapproval." : "payment.");
   //resultExtra = "Transaction ID: " + data.getStringExtra(PayPalActivity.EXTRA_PAY_KEY);
   break;
  case Activity.RESULT_CANCELED:
   resultTitle = "CANCELED";
   resultInfo = "The transaction has been cancelled.";
   resultExtra = "";
   break;
  case PayPalActivity.RESULT_FAILURE:
   resultTitle = "FAILURE";
   resultInfo = data.getStringExtra(PayPalActivity.EXTRA_ERROR_MESSAGE);
   resultExtra = "Error ID: " + data.getStringExtra(PayPalActivity.EXTRA_ERROR_ID);
  }*/
      
     
     launchSimplePayment.updateButton();
     launchParallelPayment.updateButton();
     launchChainedPayment.updateButton();
     launchPreapproval.updateButton();
     
     title.setText(resultTitle);
     title.setVisibility(View.VISIBLE);
     info.setText(resultInfo);
     info.setVisibility(View.VISIBLE);
     extra.setText(resultExtra);
     extra.setVisibility(View.VISIBLE);
    }
}
  
Now my ResultDelegate class

package com.paypal.android.simpledemo;

import java.io.Serializable;

import com.paypal.android.MEP.PayPalResultDelegate;

public class ResultDelegate implements PayPalResultDelegate, Serializable {

 private static final long serialVersionUID = 10001L;

 /**
  * Notification that the payment has been completed successfully.
  * 
  * @param payKey
  *            the pay key for the payment
  * @param paymentStatus
  *            the status of the transaction
  */
 public void onPaymentSucceeded(String payKey, String paymentStatus) {
  SimpleDemo.resultTitle = "SUCCESS";
  SimpleDemo.resultInfo = "You have successfully completed your transaction.";
  SimpleDemo.resultExtra = "Key: " + payKey;
 }

 /**
  * Notification that the payment has failed.
  * 
  * @param paymentStatus
  *            the status of the transaction
  * @param correlationID
  *            the correlationID for the transaction failure
  * @param payKey
  *            the pay key for the payment
  * @param errorID
  *            the ID of the error that occurred
  * @param errorMessage
  *            the error message for the error that occurred
  */
 public void onPaymentFailed(String paymentStatus, String correlationID,
   String payKey, String errorID, String errorMessage) {
  SimpleDemo.resultTitle = "FAILURE";
  SimpleDemo.resultInfo = errorMessage;
  SimpleDemo.resultExtra = "Error ID: " + errorID + "\nCorrelation ID: "
    + correlationID + "\nPay Key: " + payKey;
 }

 /**
  * Notification that the payment was canceled.
  * 
  * @param paymentStatus
  *            the status of the transaction
  */
 public void onPaymentCanceled(String paymentStatus) {
  SimpleDemo.resultTitle = "CANCELED";
  SimpleDemo.resultInfo = "The transaction has been cancelled.";
  SimpleDemo.resultExtra = "";
 }
}
Now PayPal Gateway in integrate with your Android application.