Set up PayPal payments
DOCS
Last updated: Aug 15th, 7:26am
Complete the steps to check out using PayPal.
Know before you code
The PayPal authorization flow includes PayPal One Touch, which buyers use to trigger an app switch that brings up the PayPal login and authorization webview, then reverts back to the app to complete the purchase.
Step 1: Display a PayPal button during checkout
Contact your account manager or a PayPal solutions engineer to get a list of approved PayPal Button assets to render the PayPal button.
Step 2: Check out with PayPal
- Use the
PYPLClientto callcheckoutWithPayPalwith a valid PayPalorderID. - Inspect the results on the
completionofcheckoutWithPayPalto handle checkout errors or to complete the transaction.
1func tappedPayPal() {2 client?.checkoutWithPayPal(orderID: orderID) { (result, error) in3 if (error != nil) {4 // handle checkout error5 return6 }78 guard let orderID = result?.orderID else { return }9 // Send orderID to your server to process the payment10 // Capture or authorize the orderID11 }12}
Calling checkoutWithPayPal redirects your buyer to a SFSafariViewController to log in with their PayPal account to complete the checkout.