Swiftpack.co - stripe/stripe-terminal-ios as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by stripe.
stripe/stripe-terminal-ios vX.Y.Z
Stripe Terminal iOS SDK
⭐️ 87
🕓 2 years ago
iOS
.package(url: "https://github.com/stripe/stripe-terminal-ios.git", from: "vX.Y.Z")

Stripe Terminal iOS SDK

Stripe Terminal enables you to build your own in-person checkout to accept payments in the physical world. Built on Stripe's payments network, Terminal helps you unify your online and offline payment channels. With the Stripe Terminal iOS SDK, you can connect to pre-certified card readers from your iOS app and drive a customized in-store checkout flow.

Get started with our integration guides and sample integration, or browse the SDK reference documentation.

Upgrading from an older version of the SDK? See our migration guide for guidance.

Requirements

The Stripe Terminal iOS SDK is compatible with apps supporting iOS 13 and above.

Try the example app

The iOS SDK includes an open-source example app, which you can use to familiarize yourself with the SDK and reader before starting your own integration.

To build the example app from source, you'll need to:

  1. Navigate to the Example folder, and open Example.xcworkspace (make sure to open the .xcworkspace and not the .xcodeproj).
  2. Navigate to our example backend and click the button to deploy it on Heroku.
  3. In AppDelegate.swift, set the URL of the Heroku app you just deployed.
  4. Build and run the app. The SDK comes with a simple reader simulator, so you can get started without any physical hardware.

Installation

We support CocoaPods and Swift Package Manager. If you prefer to install the library manually, please use the latest version from our releases page.

Swift Package Manager

In Xcode, select File > Swift Packages > Add Package Dependency and enter https://github.com/stripe/stripe-terminal-ios

CocoaPods

  1. If you haven't already, install the latest version of CocoaPods.

  2. Add this line to your Podfile:

pod 'StripeTerminal', '~> 3.0'
  1. Run the following command:
pod install

From now on, don't forget to use the *.xcworkspace file to open your project in Xcode, instead of the .xcodeproj file.

In the future, to update to the latest compatible version of the SDK, just run:

pod update StripeTerminal

Manual

  1. Navigate to our releases page, download StripeTerminal.xcframework.zip, and unzip it.

  2. Drag StripeTerminal.xcframework to the Frameworks, Libraries, and Embedded Content section of your Xcode project’s General settings. Make sure to select "Copy items if needed".

When new versions of the SDK are released, repeat the above steps to update your installation.

Configure your app

Location services must be enabled in order to use the iOS SDK. Add the following key-value pair to your app's Info.plist file:

  • Privacy - Location When In Use Usage Description
    • Key: NSLocationWhenInUseUsageDescription
    • Value: "Location access is required in order to accept payments."

Note: Stripe needs to know where payments occur to reduce risks associated with those charges and to minimize disputes. If the SDK can’t determine the iOS device’s location, payments are disabled until location access is restored.

For your app to run in the background and remain connected to the reader, add this key-value pair to your Info.plist file:

  • Required background modes
    • Key: UIBackgroundModes
    • Value: bluetooth-central (Uses Bluetooth LE accessories)
    • Note the value is actually an array that you will need to add bluetooth-central to.

For your app to pass validation when submitting to the App Store, add the following key-value pairs as well:

  • Privacy - Bluetooth Peripheral Usage Description
    • Key: NSBluetoothPeripheralUsageDescription
    • Value: “Bluetooth access is required in order to connect to supported bluetooth card readers.”
  • Privacy - Bluetooth Always Usage Description
    • Key: NSBluetoothAlwaysUsageDescription
    • Value: "This app uses Bluetooth to connect to supported card readers."

Previous API References

We maintain an archive of the API reference for the previous major version.

GitHub

link
Stars: 87
Last commit: 1 week ago
Advertisement: IndiePitcher.com - Cold Email Software for Startups

Release Notes

3.2.0
1 week ago
  • Built with Xcode 14.3, Swift version 5.8.
  • Update: retrievePaymentIntent and retrieveSetupIntent no longer require a connected reader.
  • Update: Adds SCPCharge.authorizationCode to the sdk's SCPCharge model when it is available.
    • Note for internet reader integrations, this feature requires reader software version 2.18 or later to be installed on your internet reader.
  • Update: Added network and wallet to SCPCardPresentDetails.
  • Update: Added paymentMethodId to SCPPaymentIntent.
  • Update: The amount of time a reader can be used offline before needing to be activated online has been reduced to 30 days.
  • Update: SCPReaderNetworkStatus has a new case (SCPReaderStatusUnknown) that represents the network status of an internet reader that was discovered while the SDK is operating in offline mode.
  • Fix: SCPSetupIntent.status is now SCPSetupIntentStatusRequiresConfirmation after the payment has been collected.
  • Fixes a rare crash when connecting to a Bluetooth reader with a critically low battery.
  • Fixes a rare crash when installing a Bluetooth reader update.
  • Fixes a bug where cancelPaymentIntent, createSetupIntent, and cancelSetupIntent were not being queued and could error with an unexpected SDK error if called while another command was in progress.
  • Fixes merchant choice routing not updating upon switching reader regions.
  • Fixes #262: Initial Bluetooth reader battery level is reported immediately after connecting to the reader.
  • Fixes error messaging to not return an unexpected SDK error in some situations when connected to a smart reader.
  • Fixes an issue where integrations could hit SCPErrorSessionExpired when the SDK comes back online while using offline mode.

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics