Developer's Guide

Mobile Payments Library Developer Guide and Reference –iOS Edition August 2012 7
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 iPhone 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
UIButton and returns it to you so you can place it on
the screen.
3. (Optional) Your application enables dynamic amount calculation to recalculate the payment
amount, tax, currency, and shipping values when buyers change the shipping address for the
payment.
4. Your application sets all of the payment parameters including the amount, currency, recipient,
and item details.
5. When buyers select the Pay with PayPal button, the library takes them through the PayPal
Checkout experience. The library displays itself on top of the application’s
Window object,
so be sure that you do not take control of the Window after the buyer clicks Pay with
PayPal.
6. (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 callback to
your application with the address information.
b. Your application recalculates the payment and other amounts, based on the address
and returns those on the callback.
c. The library returns the buyer to the checkout experience, which uses the updated
payment amount, tax, currency, and shipping values.
7. After buyers complete their payments, the library returns a callback to your application with
the transaction id and status of the payment. Note that, at this time, the library is still in
control of the UI and has not returned control to your application.
8. After the library flow is complete, the library returns a callback to your application indicating
it is relinquishing control of the UI.
Required Methods in the Mobile Payments Library
initializeWithAppID Method
The initializeWithAppID method creates and returns the PayPal object.
NOTE: If you do not set the optional parameter forEnvironment, the library defaults to use
the PayPal production servers. When testing your application, PayPal recommends that
you initialize the library to use the PayPal test servers, instead.