Download PayPal Mobile Express Checkout Library - 2012 iOS Developer's Guide
Transcript
1. PayPal Mobile Express Checkout Library This section provides details about the Mobile Express Checkout Library. It provides instructions and examples for using the library to embed your mobile implementation of Express Checkout in your iPhone or iPod touch application. Mobile Express Checkout Library API Reference The library supports 2 programming flows. They differ in where you place the PayPal button that buyers click to begin checking out with PayPal. Programming Flow with the PayPal Button in Your Mobile Application Place the PayPal button in your mobile application if your checkout process begins and ends with screens in your mobile application. In this programming flow, you embed only the mobile Express Checkout payment pages in a web view. 1. Fetch a device token from the library, just before you display the mobile application screen where you show a PayPal button. Include a pointer to your delegate method that receives the device token. 2. Get a PayPal button from the library, and place it on your mobile application screen. Include a pointer to your delegate method that handles the button-click event. 3. When buyers select the PayPal button, your delegate method is called: a. Call a routine on your mobile web server, passing the payment information. b. On your mobile web server, send a SetExpressCheckout request with the payment information to PayPal. c. Pass the checkout token returned in the SetExpressCheckout response from your mobile web server to your mobile application. d. Open a web view, and redirect the browser to PayPal with the mobile command, the device token, and the checkout token as URL parameters. https://www.paypal.com/cgi-bin/webscr?cmd=_express-checkoutmobile &drt=valueFromMobileExpressCheckoutLibrary&token=valueFromSetExpr essCheckoutResponse 4. Monitor the web view for a redirect from PayPal to your return or cancel URL. 5. If PayPal redirects the web view to your return URL, call surrogate routines on your mobile web server that send GetExpressCheckoutDetails and DoExpressCheckoutPayment requests to PayPal to complete the payment. IMPORTANT: Never send Express Checkout requests from your mobile application directly to PayPal. The requests require your PayPal API credentials. Placing your credentials on mobile PayPal Mobile Express Checkout Library Developer Guide and Reference January 2011 7