Skip to content

paypal-examples/paypal-ios-sdk-demo-app

Repository files navigation

PayPal iOS SDK Demo App

This repository contains a SwiftUI demo app that simulates a real-world merchant application, featuring a store, cart, and checkout process.
The goal of this app is to showcase core features of the PayPal iOS SDK, providing merchants with sample code and implementation patterns to simplify integration.

πŸš€ Version 1.0 Features

Checkout with PayPal
Seamless PayPal checkout experience
Checkout with Cards

🎯 Purpose This demo app serves as a reference for merchants, aligning with real-world patterns and code structures they are likely to adopt.
By providing a practical and easy-to-follow example, we aim to make PayPal SDK integration smoother and faster for developers.

πŸ“‚ Project Structure

  • Where to find key logic
    If you are just interested in code to implement server side and SDK API calls, you can skip to CardPaymentViewModel or PayPalViewModel

  • CheckoutFlow
    SwiftUI view that is the entry point for the checkout process. It sets up the overall navigation structure using a NavigationStack, so users can move from cart checkout and finally OrderCompletion

  • CheckoutCoordinator (Navigation and Flow Manager)
    Handles navigation logic and handles loading and error states of flows that do not have a dedicated SwiftUI view (e.g., PayPal Web Checkout)

  • CartView
    Displays items in the cart and total amount
    Buttons to initiate Card or PayPalWeb checkout
    Tapping either calls into a CheckoutCoordinator that starts the respective flow

  • Card Checkout
    This uses a SwiftUI screen called CardCheckoutView which references a CardPaymentViewModel
    The view model handles network calls for creating order, approving the card and final capture
    When complete, the user is navigated to OrderCompleteView

  • PayPal Web Checkout
    No dedicated SwiftUI screen - once triggered, it opens a web flow
    Becuase there is no dedicated PayPal view, we handle loading and errors in a CheckoutCoordinator
    If the user completes the PayPal flow, we capture the order and show OrderCompleteView

πŸ”§ Requirements

Xcode 15.0+ iOS 15.0+ PayPal iOS SDK

πŸ›  Setup

Clone this repository: bash Copy code git clone https://github.com/paypal-examples/paypal-ios-sdk-demo-app.git cd paypal-ios-sdk-demo-app Open the project in Xcode. Run the app on a simulator or device.

About

Sample iOS demo app for PPCP mobile SDK

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages