Swiftpack.co - primer-io/primer-sdk-ios as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by primer-io.
primer-io/primer-sdk-ios v.1.5.0
iOS SDK for Primer
⭐️ 12
🕓 2 years ago
iOS
.package(url: "https://github.com/primer-io/primer-sdk-ios.git", from: "v.1.5.0")

Primer iOS SDK

Primer's Official Universal Checkout iOS SDK




💪 Features of the iOS SDK

💳   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

📚 Documentation

Consider looking at the following resources:

💡 Support

For any support or integration related queries, feel free to Contact Us.

🚀 Quick start

Take a look at our Quick Start Guide for accepting your first payment with Universal Checkout.


🧱 Installation

With CocoaPods

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.

With Swift Package Manager

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;

  1. Select your project, and then navigate to Package Dependencies
  2. Click on the + button at the bottom-left of the Packages section
  3. Paste https://github.com/primer-io/primer-sdk-ios.git into the Search Bar
  4. Press Add Package
  5. Let Xsrc="https://raw.github.com/primer-io/primer-sdk-ios/master/download the package and set everything up

👩‍💻 Usage

📋 Prerequisites

🔍  Initializing the SDK

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.

🔍  Rendering the checkout

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.

Contributing guidelines:

Contributing doc

Using the Debug App

The Debug App provides you with tools to test your Primer configuration and interact with different payment methods and Universal Checkout features

GitHub

link
Stars: 12
Last commit: 11 hours ago
Advertisement: IndiePitcher.com - Cold Email Software for Startups

Release Notes

Release 2.26.2
1 week ago

2.26.2 (2024-04-15)

Fix

  • Fix reported CI/CD issues for nol Pay (#840)
  • Replace URLSessionStack with new async/await compatible network service (#819)
  • Fix Nol pay Xcode errors (#837)

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