Developer's Guide

8 July 2011 PayPal Mobile Payments Developer Guide and Reference Android OS Edition
1. PayPal Mobile Payments Library
This section provides details about the Mobile Payments Library API, and it provides instructions
and examples for integrating the library with your Android application.
Mobile Payments Library API Reference
The flow of the library is:
1. Your application initializes the library.
2. The library creates a Pay with PayPal Button and returns it to you so you can place it on
the screen.
3. (Optional) Your application enables Dynamic Amount Calculation (see step 4 below) to
recalculate the payment amount, tax, currency, and shipping values when buyers change the
shipping address for the payment.
4. When buyers select the Pay with PayPal button, the library takes them through the PayPal
Checkout experience.
5. (Optional) If you enabled dynamic amount calculation in step 1 above:
a. When a buyer chooses an address for the payment, the library returns a call back to
your application with the address information.
b. Your application recalculates the payment and other amounts, based on the address.
c. The library returns the buyer to the checkout experience, which uses the updated
payment amount, tax, currency, and shipping values.
6. After buyers complete their payments, the library returns a callback to your application with
the status of the payment and the pay key. Note: at this time, the library is still in control of
the UI and has not returned control to your application.
7. After the library flow is complete, an activity result will be posted to be received by your
application.
Declaring the Library and Permissions in AndroidManifest.xml
Since the Mobile Payments Library is an Activity, you must declare it in the
AndroidManifest.xml file of your application. You must also declare Internet and Phone
State permissions that the Library requires. Below is an example AndroidManifest.xml. Sections
specifically relevant to the Library are in bold:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.paypal.MobilePayments.Pizza"
android:versionCode="1"
android:versionName="1.0">
<application android:icon="@drawable/icon"
android:label="@string/app_name">
<activity android:name=".PizzaMain"