Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 1.6.1 #50

Merged
merged 6 commits into from
Mar 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 17 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,13 @@

# Square In-App Payments iOS SDK

Build remarkable payments experiences in your own apps with Square’s [In-App Payments SDK](https://docs.connect.squareup.com/payments/in-app-payments-sdk/what-it-does). Use our pre-built UI to collect sensitive credit card details from your customers, while matching the look and feel of your app. Square takes care of all the complexity of payments - security, risk, and PCI compliance are managed for you, so that you can focus on building the rest of your application.
Build remarkable payments experiences in your own apps with Square’s [In-App Payments SDK](https://developer.squareup.com/docs/in-app-payments-sdk/what-it-does). Use our pre-built UI to collect sensitive credit card details from your customers, while matching the look and feel of your app. Square takes care of all the complexity of payments - security, risk, and PCI compliance are managed for you, so that you can focus on building the rest of your application.

You can also pair our Square In-App Payments SDK with Square’s [Online Payments APIs](https://squareup.com/developers/online-payment-apis) and [Reader SDK](https://squareup.com/developers/reader-sdk) to accept payments across all channels - online, in-person and in-app - while keeping your back office reporting unified in a single system.

## Installation

### Add frameworks

#### SPM

[Swift Package Manager](https://www.swift.org/package-manager/) support is available for Swift 5.3 and above. Simply add the following to your top-level `dependencies` block within your `Package.swift`:

```swift
dependencies: [
.package(url: "https://github.com/square/in-app-payments-ios", .upToNextMajor(from: "1.6.0")),
]
```
### 1. Add frameworks

#### Cocoapods

Expand All @@ -39,16 +29,29 @@ Install with [Carthage](https://github.com/Carthage/Carthage) by adding the foll
github "square/in-app-payments-ios"
```

## Add build phase to setup the SquareInAppPaymentsSDK and/or SquareBuyerVerificationSDK framework ##
### 2. Add build phase to setup the SquareInAppPaymentsSDK and/or SquareBuyerVerificationSDK framework ###
After adding the framework using any of the above methods, follow the below instructions to complete the setup.

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), add the following contents to the script area below the shell:

```
FRAMEWORKS="${BUILT_PRODUCTS_DIR}/${FRAMEWORKS_FOLDER_PATH}"
"${FRAMEWORKS}/SquareInAppPaymentsSDK.framework/setup"
```

Make sure the above run script is below any `[CP] Embed Pods Frameworks` or `Embed Frameworks` Build Phase.

## Swift Package Manager

[Swift Package Manager](https://www.swift.org/package-manager/) support is available for Swift 5.3 and above but is currently **not** the recommended method for adding the Square In-App Payments SDK dependency.

Setup instructions can be found [here](SPM_README.md).


### iPhone and iPad apps on Mac with Apple silicon

Square In-App Payments iOS SDK currently does not support iPhone and iPad apps on Mac with Apple silicon.

### Getting Started

For more information and setup instructions, please visit the [Square In-App Payments iOS SDK page](https://docs.connect.squareup.com/payments/in-app-payments-sdk/build-on-ios).
For more information and setup instructions, please visit the [Square In-App Payments iOS SDK page](https://developer.squareup.com/docs/in-app-payments-sdk/build-on-ios).
22 changes: 22 additions & 0 deletions SPM_README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
## Swift Package Manager

### 1. Add the following to your top-level `dependencies` block within your `Package.swift`:

```swift
dependencies: [
.package(url: "https://github.com/square/in-app-payments-ios", .upToNextMajor(from: "1.6.1")),
]
```

### 2. Add build phase to setup the SquareInAppPaymentsSDK and/or SquareBuyerVerificationSDK framework ###

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), add the following contents to the script area below the shell:

```
SETUP_SCRIPT="${CONFIGURATION_BUILD_DIR}/SquareInAppPaymentsSDK.framework/setup"
if [ -f "$SETUP_SCRIPT" ]; then
"$SETUP_SCRIPT"
fi
```

**Important Note:** The build phase script requires you to reset your Swift Package Caches when switching from a debug build to a release build (archiving) or vice versa. This helps prevent errors during building or releasing. You can reset your cache by using `File -> Packages -> Reset Package Caches` in Xcode.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,20 @@ IFS=$(echo "")

IAP_SDK_FRAMEWORKS=("SquareInAppPaymentsSDK" "SquareBuyerVerificationSDK")
MAIN_FRAMEWORKS_DIR="$BUILT_PRODUCTS_DIR/$FRAMEWORKS_FOLDER_PATH"
SECONDARY_FRAMEWORKS_DIR="$CONFIGURATION_BUILD_DIR"

# Unpack frameworks
for FRAMEWORK_NAME in "${IAP_SDK_FRAMEWORKS[@]}"; do
NESTED_FRAMEWORKS_DIR="$MAIN_FRAMEWORKS_DIR/$FRAMEWORK_NAME.framework/Frameworks"
FRAMEWORK_PATH="$FRAMEWORK_NAME.framework/Frameworks"
MAIN_NESTED_FRAMEWORKS_DIR="$MAIN_FRAMEWORKS_DIR/$FRAMEWORK_PATH"
SECONDARY_NESTED_FRAMEWORKS_DIR="$SECONDARY_FRAMEWORKS_DIR/$FRAMEWORK_PATH"

if [ -d "$MAIN_NESTED_FRAMEWORKS_DIR" ]; then
NESTED_FRAMEWORKS_DIR=$MAIN_NESTED_FRAMEWORKS_DIR
else
NESTED_FRAMEWORKS_DIR=$SECONDARY_NESTED_FRAMEWORKS_DIR
fi

if [ -d "$NESTED_FRAMEWORKS_DIR" ]; then
# Handle all nested frameworks that are fat frameworks
find "$NESTED_FRAMEWORKS_DIR" -name '*.framework' ! -path '*.xcframework/*' -type d | while read -r FRAMEWORK; do
Expand Down Expand Up @@ -57,6 +67,24 @@ for FRAMEWORK_NAME in "${IAP_SDK_FRAMEWORKS[@]}"; do
fi
done

# Workaround for Swift Package Manager
SOURCE_PACKAGE_FRAMEWORK_DIR="${BUILD_DIR%Build/*}SourcePackages/checkouts/in-app-payments-ios/XCFrameworks"

if [ -d "$SOURCE_PACKAGE_FRAMEWORK_DIR" ]; then
for FRAMEWORK_NAME in "${IAP_SDK_FRAMEWORKS[@]}"; do
FRAMEWORK_PATH="$FRAMEWORK_NAME.xcframework"
SOURCE_FRAMEWORK_NESTED_DIR="$SOURCE_PACKAGE_FRAMEWORK_DIR/$FRAMEWORK_PATH"
# Find root directory inside of regular and simulator folders
find "$SOURCE_FRAMEWORK_NESTED_DIR" -name '*.framework' ! -path '*.framework/Frameworks/*' -type d | while read -r FRAMEWORK_DIR; do
rm -rf "$FRAMEWORK_DIR/Frameworks"
# Delete the setup script if archiving
if [ "$ACTION" = "install" ]; then
rm -rf "$FRAMEWORK_DIR/setup"
fi
done
done
fi

IFS=$OLDIFS

# Don't choke if projects or targets have spaces in the name
Expand All @@ -77,4 +105,4 @@ find "${CODESIGNING_FOLDER_PATH}/Frameworks" -name "*.framework" | while read -r
fi
done

IFS=$OLDIFS
IFS=$OLDIFS
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,20 @@ IFS=$(echo "")

IAP_SDK_FRAMEWORKS=("SquareInAppPaymentsSDK" "SquareBuyerVerificationSDK")
MAIN_FRAMEWORKS_DIR="$BUILT_PRODUCTS_DIR/$FRAMEWORKS_FOLDER_PATH"
SECONDARY_FRAMEWORKS_DIR="$CONFIGURATION_BUILD_DIR"

# Unpack frameworks
for FRAMEWORK_NAME in "${IAP_SDK_FRAMEWORKS[@]}"; do
NESTED_FRAMEWORKS_DIR="$MAIN_FRAMEWORKS_DIR/$FRAMEWORK_NAME.framework/Frameworks"
FRAMEWORK_PATH="$FRAMEWORK_NAME.framework/Frameworks"
MAIN_NESTED_FRAMEWORKS_DIR="$MAIN_FRAMEWORKS_DIR/$FRAMEWORK_PATH"
SECONDARY_NESTED_FRAMEWORKS_DIR="$SECONDARY_FRAMEWORKS_DIR/$FRAMEWORK_PATH"

if [ -d "$MAIN_NESTED_FRAMEWORKS_DIR" ]; then
NESTED_FRAMEWORKS_DIR=$MAIN_NESTED_FRAMEWORKS_DIR
else
NESTED_FRAMEWORKS_DIR=$SECONDARY_NESTED_FRAMEWORKS_DIR
fi

if [ -d "$NESTED_FRAMEWORKS_DIR" ]; then
# Handle all nested frameworks that are fat frameworks
find "$NESTED_FRAMEWORKS_DIR" -name '*.framework' ! -path '*.xcframework/*' -type d | while read -r FRAMEWORK; do
Expand Down Expand Up @@ -57,6 +67,24 @@ for FRAMEWORK_NAME in "${IAP_SDK_FRAMEWORKS[@]}"; do
fi
done

# Workaround for Swift Package Manager
SOURCE_PACKAGE_FRAMEWORK_DIR="${BUILD_DIR%Build/*}SourcePackages/checkouts/in-app-payments-ios/XCFrameworks"

if [ -d "$SOURCE_PACKAGE_FRAMEWORK_DIR" ]; then
for FRAMEWORK_NAME in "${IAP_SDK_FRAMEWORKS[@]}"; do
FRAMEWORK_PATH="$FRAMEWORK_NAME.xcframework"
SOURCE_FRAMEWORK_NESTED_DIR="$SOURCE_PACKAGE_FRAMEWORK_DIR/$FRAMEWORK_PATH"
# Find root directory inside of regular and simulator folders
find "$SOURCE_FRAMEWORK_NESTED_DIR" -name '*.framework' ! -path '*.framework/Frameworks/*' -type d | while read -r FRAMEWORK_DIR; do
rm -rf "$FRAMEWORK_DIR/Frameworks"
# Delete the setup script if archiving
if [ "$ACTION" = "install" ]; then
rm -rf "$FRAMEWORK_DIR/setup"
fi
done
done
fi

IFS=$OLDIFS

# Don't choke if projects or targets have spaces in the name
Expand All @@ -77,4 +105,4 @@ find "${CODESIGNING_FOLDER_PATH}/Frameworks" -name "*.framework" | while read -r
fi
done

IFS=$OLDIFS
IFS=$OLDIFS
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,20 @@ IFS=$(echo "")

IAP_SDK_FRAMEWORKS=("SquareInAppPaymentsSDK" "SquareBuyerVerificationSDK")
MAIN_FRAMEWORKS_DIR="$BUILT_PRODUCTS_DIR/$FRAMEWORKS_FOLDER_PATH"
SECONDARY_FRAMEWORKS_DIR="$CONFIGURATION_BUILD_DIR"

# Unpack frameworks
for FRAMEWORK_NAME in "${IAP_SDK_FRAMEWORKS[@]}"; do
NESTED_FRAMEWORKS_DIR="$MAIN_FRAMEWORKS_DIR/$FRAMEWORK_NAME.framework/Frameworks"
FRAMEWORK_PATH="$FRAMEWORK_NAME.framework/Frameworks"
MAIN_NESTED_FRAMEWORKS_DIR="$MAIN_FRAMEWORKS_DIR/$FRAMEWORK_PATH"
SECONDARY_NESTED_FRAMEWORKS_DIR="$SECONDARY_FRAMEWORKS_DIR/$FRAMEWORK_PATH"

if [ -d "$MAIN_NESTED_FRAMEWORKS_DIR" ]; then
NESTED_FRAMEWORKS_DIR=$MAIN_NESTED_FRAMEWORKS_DIR
else
NESTED_FRAMEWORKS_DIR=$SECONDARY_NESTED_FRAMEWORKS_DIR
fi

if [ -d "$NESTED_FRAMEWORKS_DIR" ]; then
# Handle all nested frameworks that are fat frameworks
find "$NESTED_FRAMEWORKS_DIR" -name '*.framework' ! -path '*.xcframework/*' -type d | while read -r FRAMEWORK; do
Expand Down Expand Up @@ -57,6 +67,24 @@ for FRAMEWORK_NAME in "${IAP_SDK_FRAMEWORKS[@]}"; do
fi
done

# Workaround for Swift Package Manager
SOURCE_PACKAGE_FRAMEWORK_DIR="${BUILD_DIR%Build/*}SourcePackages/checkouts/in-app-payments-ios/XCFrameworks"

if [ -d "$SOURCE_PACKAGE_FRAMEWORK_DIR" ]; then
for FRAMEWORK_NAME in "${IAP_SDK_FRAMEWORKS[@]}"; do
FRAMEWORK_PATH="$FRAMEWORK_NAME.xcframework"
SOURCE_FRAMEWORK_NESTED_DIR="$SOURCE_PACKAGE_FRAMEWORK_DIR/$FRAMEWORK_PATH"
# Find root directory inside of regular and simulator folders
find "$SOURCE_FRAMEWORK_NESTED_DIR" -name '*.framework' ! -path '*.framework/Frameworks/*' -type d | while read -r FRAMEWORK_DIR; do
rm -rf "$FRAMEWORK_DIR/Frameworks"
# Delete the setup script if archiving
if [ "$ACTION" = "install" ]; then
rm -rf "$FRAMEWORK_DIR/setup"
fi
done
done
fi

IFS=$OLDIFS

# Don't choke if projects or targets have spaces in the name
Expand All @@ -77,4 +105,4 @@ find "${CODESIGNING_FOLDER_PATH}/Frameworks" -name "*.framework" | while read -r
fi
done

IFS=$OLDIFS
IFS=$OLDIFS
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,20 @@ IFS=$(echo "")

IAP_SDK_FRAMEWORKS=("SquareInAppPaymentsSDK" "SquareBuyerVerificationSDK")
MAIN_FRAMEWORKS_DIR="$BUILT_PRODUCTS_DIR/$FRAMEWORKS_FOLDER_PATH"
SECONDARY_FRAMEWORKS_DIR="$CONFIGURATION_BUILD_DIR"

# Unpack frameworks
for FRAMEWORK_NAME in "${IAP_SDK_FRAMEWORKS[@]}"; do
NESTED_FRAMEWORKS_DIR="$MAIN_FRAMEWORKS_DIR/$FRAMEWORK_NAME.framework/Frameworks"
FRAMEWORK_PATH="$FRAMEWORK_NAME.framework/Frameworks"
MAIN_NESTED_FRAMEWORKS_DIR="$MAIN_FRAMEWORKS_DIR/$FRAMEWORK_PATH"
SECONDARY_NESTED_FRAMEWORKS_DIR="$SECONDARY_FRAMEWORKS_DIR/$FRAMEWORK_PATH"

if [ -d "$MAIN_NESTED_FRAMEWORKS_DIR" ]; then
NESTED_FRAMEWORKS_DIR=$MAIN_NESTED_FRAMEWORKS_DIR
else
NESTED_FRAMEWORKS_DIR=$SECONDARY_NESTED_FRAMEWORKS_DIR
fi

if [ -d "$NESTED_FRAMEWORKS_DIR" ]; then
# Handle all nested frameworks that are fat frameworks
find "$NESTED_FRAMEWORKS_DIR" -name '*.framework' ! -path '*.xcframework/*' -type d | while read -r FRAMEWORK; do
Expand Down Expand Up @@ -57,6 +67,24 @@ for FRAMEWORK_NAME in "${IAP_SDK_FRAMEWORKS[@]}"; do
fi
done

# Workaround for Swift Package Manager
SOURCE_PACKAGE_FRAMEWORK_DIR="${BUILD_DIR%Build/*}SourcePackages/checkouts/in-app-payments-ios/XCFrameworks"

if [ -d "$SOURCE_PACKAGE_FRAMEWORK_DIR" ]; then
for FRAMEWORK_NAME in "${IAP_SDK_FRAMEWORKS[@]}"; do
FRAMEWORK_PATH="$FRAMEWORK_NAME.xcframework"
SOURCE_FRAMEWORK_NESTED_DIR="$SOURCE_PACKAGE_FRAMEWORK_DIR/$FRAMEWORK_PATH"
# Find root directory inside of regular and simulator folders
find "$SOURCE_FRAMEWORK_NESTED_DIR" -name '*.framework' ! -path '*.framework/Frameworks/*' -type d | while read -r FRAMEWORK_DIR; do
rm -rf "$FRAMEWORK_DIR/Frameworks"
# Delete the setup script if archiving
if [ "$ACTION" = "install" ]; then
rm -rf "$FRAMEWORK_DIR/setup"
fi
done
done
fi

IFS=$OLDIFS

# Don't choke if projects or targets have spaces in the name
Expand All @@ -77,4 +105,4 @@ find "${CODESIGNING_FOLDER_PATH}/Frameworks" -name "*.framework" | while read -r
fi
done

IFS=$OLDIFS
IFS=$OLDIFS
2 changes: 1 addition & 1 deletion podspec_constants.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module SquareInAppPaymentsSDK
VERSION = '1.6.0'
VERSION = '1.6.1'
LICENSE_TYPE = 'Square Developer License'
LICENSE_TEXT = <<-LICENSE
Copyright (c) 2018-present, Square, Inc. All rights reserved.
Expand Down