Build remarkable in-person experiences using Square's Mobile Payments SDK product, now in beta. Use the Mobile Payments SDK to accept in-person payments using Square hardware. The Mobile Payments SDK has the advantage of being an API-driven framework that allows for full customization and uses the latest v2/payments API.
Learn what you can do with the Mobile Payments SDK here.
Install with Swift Package Manager by following these steps:
- Select
File > Add Package Dependencies...
. - Enter the repository URL:
https://github.com/square/mobile-payments-sdk-ios
. - Select the
Exact Version
dependency rule and specify the version as2.0.1
. - Ensure the
SquareMobilePaymentsSDK
product is added to your target.
Optionally, you can also add the MockReaderUI
product to your target to simulate a physical reader when one is not present in a sandbox environment.
Install with CocoaPods by adding the following to your Podfile
:
use_frameworks!
pod "SquareMobilePaymentsSDK", "~> 2.0.1"
# Optionally include MockReaderUI if you wish to simulate a physical reader when one is not present.
# This feature is only available when provided a sandbox application ID.
pod "MockReaderUI", "~> 2.0.1", configurations: ['Debug']
Note that MockReaderUI framework requires the SquareMobilePaymentsSDK
framework to also be present in your Podfile
.
On your application targets’ Build Phases
settings tab, click the + icon and choose New Run Script Phase
. Create a Run Script in which you specify your shell (ex: /bin/sh), and add the following contents to the script area below the shell:
SETUP_SCRIPT=${BUILT_PRODUCTS_DIR}/${FRAMEWORKS_FOLDER_PATH}"/SquareMobilePaymentsSDK.framework/setup"
if [ -f "$SETUP_SCRIPT" ]; then
"$SETUP_SCRIPT"
fi
Make sure this build phase is after any [CP] Embed Pods Frameworks
or Embed Frameworks
Build Phase.
Warning
Please note that the MockReaderUI
product should only be used in debug configurations and is not to be included in the release version of your application.
Follow the Build on iOS guide to learn how to integrate the Mobile Payments SDK in your app.
- Mobile Payments SDK Overview
- iOS Tech Reference
If you need more assistance, contact Developer and App Marketplace Support or ask for help in the Developer Forums.
Donut Counter is a sample application included in the Examples folder of this repository. It is built using SwiftUI and designed to help developers utilize the Square Mobile Payments SDK. This application serves as a practical guide for integrating and leveraging the SDK's capabilities within your own projects. It demonstrates essential functions such as initializing and authorizing the SDK, pairing with Square card readers and mock readers, and processing a $1.00 payment.