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

  1. Use the PYPLClient to call checkoutWithPayPal with a valid PayPal orderID.
  2. Inspect the results on the completion of checkoutWithPayPal to handle checkout errors or to complete the transaction.
    1func tappedPayPal() {
    2 client?.checkoutWithPayPal(orderID: orderID) { (result, error) in
    3 if (error != nil) {
    4 // handle checkout error
    5 return
    6 }
    7
    8 guard let orderID = result?.orderID else { return }
    9 // Send orderID to your server to process the payment
    10 // Capture or authorize the orderID
    11 }
    12}

    Calling checkoutWithPayPal redirects your buyer to a SFSafariViewController to log in with their PayPal account to complete the checkout.

    Next step

    Process the order