💳 Create great payment experiences with our highly customizable Universal Checkout
🧩 Connect and configure any new payment method without a single line of code
✅ Dynamically handle 3DS 2.0 across processors and be SCA ready
♻️ Store payment methods for recurring and repeat payments
🔒 Always PCI compliant without redirecting customers
Consider looking at the following resources:
For any support or integration related queries, feel free to Contact Us.
Take a look at our Quick Start Guide for accepting your first payment with Universal Checkout.
The iOS SDK is available via Cocoapods. Add the PrimerSDK to your Podfile:
target 'MyApp' do
# Other pods...
# Add this to your Podfile
pod 'PrimerSDK' # Add this line
end
Then, at the root of this repo, open your terminal and run
bundle install
cd Debug\ App
bundle exec pod install
For specific versions of the SDK, please refer to the changelog.
The Swift Package Manager is a tool for automating the distribution of Swift code and is integrated into Xcode. In order to add PrimerSDK with Swift Package Manager;
- Select your project, and then navigate to Package Dependencies
- Click on the + button at the bottom-left of the Packages section
- Paste https://github.com/primer-io/primer-sdk-ios.git into the Search Bar
- Press Add Package
- Let Xcode download the package and set everything up
- 🔑 Generate a client token by creating a client session in your backend.
- 🎉 That's it!
Import the Primer SDK and set its delegate as shown in the following example:
import PrimerSDK
class MyViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Initialize the SDK with the default settings.
Primer.shared.configure(delegate: self)
}
}
extension MyViewController: PrimerDelegate {
func primerDidCompleteCheckoutWithData(_ data: CheckoutData) {
// Primer checkout completed with data
// do something...
}
}
Note: Check the SDK API Reference for more options to customize your SDK.
Now you can use the client token that you generated on your backend.
Call the showUniversalCheckout(clientToken)
function (as shown below) to present Universal Checkout.
class MyViewController: UIViewController {
func startUniversalCheckout() {
Primer.shared.showUniversalCheckout(clientToken: self.clientToken)
}
}
You should now be able to see Universal Checkout! The user can now interact with Universal Checkout, and the SDK will create the payment.
The payment’s data will be returned on primerDidCompleteCheckoutWithData(:)
.
Note: There are more options which can be passed to Universal Checkout. Please refer to the section below for more information.
The Debug App provides you with tools to test your Primer configuration and interact with different payment methods and Universal Checkout features