The PayPal iOS SDK makes it easy to add PayPal and credit card payments to mobile apps.
This documentation is available in Japanese: 日本語のドキュメント.
There are 4 static libraries that you should link when building your application.
libPayPalMobile.a
,libCardIO.a
,libopencv_core.a', and
libopencv_imgproc.a` are required for all of the SDK functionality.The current version of the PayPal iOS SDK was built using Xcode 7.0+.
If you are still using Xcode 6.4, you may experience link errors (duplicate symbols). If you can't upgrade from Xcode 6.4, please use version 2.11.x of this SDK.
If you are still using Xcode 6.2, you may experience link errors (duplicate symbols). If you can't upgrade from Xcode 6.2, please use version 2.10.2 of this SDK.
- Use Cases
- Requirements
- Add the SDK to Your Project
- Credentials
- International Support
- Testing
- Documentation
- Usability
- Moving to PayPal iOS SDK 2.0
- Next Steps
The SDK supports two use cases for making payments - Single Payment and Future Payments - and a third use case for obtaining information about the customer - Profile Sharing.
Receive a one-time payment from a customer's PayPal account or payment card (scanned with card.io). This can be either (1) an immediate payment which your servers should subsequently verify, or (2) an authorization for a payment which your servers must subsequently capture, or (3) a payment for an order which your servers must subsequently authorize and capture:
- Accept a Single Payment and receive back a proof of payment.
- On your server, Verify the Payment, Capture the Payment, or Process the Order (PayPal Developer site) using PayPal's API.
Note: Direct Credit Card Payments is only available in a select few countries. Also, see the International Support section for details on the specific currencies supported.
Your customer logs in to PayPal just one time and consents to future payments:
- Obtain Customer Consent to receive an authorization code.
- On your server, use this authorization code to Obtain OAuth2 Tokens.
Later, when that customer initiates a payment:
- Obtain a Client Metadata ID that you'll pass to your server.
- On your server, Create a Payment using your OAuth2 tokens, the Client Metadata ID, and PayPal's API.
Your customer logs in to PayPal and consents to PayPal sharing information with you:
- Obtain Customer Consent to receive an authorization code.
- On your server, use this authorization code to Obtain OAuth2 Tokens.
- On your server, Retrieve Customer Information using your OAuth2 tokens and PayPal's API.
- Xcode 7 and iOS SDK 9
- iOS 6.0+ target deployment
- armv7, armv7s, and arm64 devices, and the simulator (not armv6)
- iPhone and iPad of all sizes and resolutions
If you use CocoaPods, then add these lines to your podfile:
platform :ios, '6.0'
pod 'PayPal-iOS-SDK'
- Clone or download the SDK, which consists of header files, license acknowledgements, release notes, and a static library. It also includes a sample app.
- As of version 2.12.0, the SDK requires Xcode 7 and iOS 8 SDK.
- Add the
PayPalMobile
directory (containing several .h files and libPayPalMobile.a) to your Xcode project. We recommend checking "Copy items..." and selecting "Create groups...". - (Optionally) Add the
CardIO
directory (containing several .h files,libCardIO.a
,libopencv_core.a
, andlibopencv_imgproc.a
) to your Xcode project. We recommend checking "Copy items..." and selecting "Create groups...".libCardIO.a
,libopencv_core.a
, andlibopencv_imgproc.a
adds the functionality to pay by scanning a card. - In your project's Build Settings (in the
TARGETS
section, not thePROJECTS
section):
- add
-lc++ -ObjC
toOther Linker Flags
- enable
Enable Modules (C and Objective-C)
- enable
Link Frameworks Automatically
- In your project's Build Phases, link your project with these libraries. Weak linking for iOS versions back to 6.0 is supported.
Accelerate.framework
AudioToolbox.framework
AVFoundation.framework
CoreLocation.framework
CoreMedia.framework
MessageUI.framework
MobileCoreServices.framework
SystemConfiguration.framework
SafariServices.framework
- Add the open source license acknowledgments from acknowledgments.md to your app's acknowledgments.
- In your app's Info.plist, add the following URL schemes to
LSApplicationQueriesSchemes
:
com.paypal.ppclient.touch.v1
com.paypal.ppclient.touch.v2
org-appextension-feature-password-management
Your mobile integration requires different client_id
values for each environment: Live and Test (Sandbox).
Your server integrations for verifying or creating payments will also require the corresponding client_secret
for each client_id
.
You can obtain these PayPal API credentials by visiting the Applications page on the PayPal Developer site and logging in with your PayPal account.
Once logged in on this Applications page, you will be assigned test credentials, including Client ID, which will let you test your iOS integration against the PayPal Sandbox.
While testing your app, when logging in to PayPal in the SDK's UI you should use a personal Sandbox account email and password. I.e., not your Sandbox business credentials.
You can create both business and personal Sandbox accounts on the Sandbox accounts page.
To obtain your live credentials, you will need to have a business account. If you don't yet have a business account, there is a link at the bottom of that same Applications page that will get you started.
The SDK has built-in translations for many languages and locales. See the header files for a complete list.
The SDK supports multiple currencies. See the REST API country and currency documentation for a complete, up-to-date list.
Note that currency support differs for payment card versus PayPal payments. Unless you disable payment card acceptance (via the PayPalConfiguration.acceptCreditCards
property), we recommend limiting transactions to currencies supported by both payment types. Currently these are: USD, GBP, CAD, EUR, JPY.
If your app initiates a transaction with a currency that turns out to be unsupported for the user's selected payment type, then the SDK will display an error to the user and write a message to the console log.
During development and testing, set the environment to Sandbox or NoNetwork/Mock mode, to avoid moving real money around. See the header files for more information.
- These docs in the SDK, which include an overview of usage, step-by-step integration instructions, and sample code.
- The sample app included in this SDK.
- Header files are thoroughly documented; refer to them as needed for extra details about any given property or parameter.
- The PayPal Developer Docs, which cover error codes and server-side integration instructions.
User interface appearance and behavior is set within the library itself. For the sake of usability and user experience consistency, apps should not adjust appearance properties or attempt to modify the SDK's behavior beyond the documented methods in the provided headers.
Specifically, if you are using UIAppearance
to modify the appearance of any UI elements in your app, you should reverse those changes prior to presenting our viewcontroller, and set them again after dismissing the viewcontroller.
As a major version change, the API introduced in 2.0 is not backward compatible with 1.x integrations. However, the SDK still supports all previous single payment functionality. Upgrading is straightforward.
- Initialization of the SDK is performed via methods of a new
PayPalMobile
class. - Most of the properties of
PayPalPaymentViewController
have been moved toPayPalConfiguration
, and thePayPalPaymentViewController
initializer has changed to take such a configuration object. - The
PayPalPaymentDelegate
protocol methods have also been altered to include aPayPalPaymentViewController
as a parameter.
PayPal is in the process of replacing the older "Mobile Payments Libraries" (MPL) with the new PayPal Android and iOS SDKs. The new Mobile SDKs are based on the PayPal REST API, while the older MPL uses the Adaptive Payments API.
Until features such as third-party, parallel, and chained payments are available, if needed, you can use MPL:
Issues related to MPL should be filed in the sdk-packages repo.
Developers with existing Express Checkout integrations or who want additional features may wish to use Mobile Express Checkout in a webview.
Depending on your use case, you can now: