Installation

Option 1 Swift Package Manager

  1. Add the following repository URL
https://github.com/Imprint-Tech/imprint-sdk-ios
  1. Select your desired version or branch
  2. Click Add Package
Or you can also add Imprint as a dependency to your `Package.swift`:
dependencies: [
    .package(url: "https://github.com/Imprint-Tech/imprint-sdk-ios", from: "0.2.0")
]

Option 2 Cocoapods

(minimum support cocoapods version: 1.16.1)
  1. Add Imprint to your Podfile
target 'YourApp' do
  pod 'Imprint'   
end
  1. Install the dependencies
pod install
  1. open the project file

Update Dependencies

Option 1 Swift Package Manager

  • Tap Update Package from the menu
Screenshot2025 05 08at17 12 56 Pn

Option 2 Cocoapods

pod update

Implementation

  1. Import the SDK
Import the SDK in your view controllers or wherever needed:
import Imprint
  1. Configuration
Create an instance of ImprintConfiguration with your client_secret and environment, then assign additional optional fields as needed.
let configuration = ImprintConfiguration(clientSecret: "client_secret", environment: .sandbox)
  1. Define the Completion Handler
Define the completion handler  to manage the terminal states when the application flow ends.
configuration.onCompletion = { state, data in
  switch state {
  case .offerAccepted:
    print("Offer accepted, data: \(String(describing: data))")
  case .rejected:
    print("Application rejected, data: \(String(describing: data))")
  case .inProgress:
    print("Incomplete application, data: \(String(describing: data))")
  case .error:
    print("Error occurred, data: \(String(describing: data))")
  }
  // Perform any generic actions after the flow ends if needed
}
  1. Start the Application flow
Once you’ve configured the , initiate the application flow by calling  from your view controller.
public static func startApplication(from viewController: UIViewController, configuration: ImprintConfiguration) 
  • viewController: The view controller from which the application flow will be presented
  • configuration: The previously created  object containing your API key and completion handler

Complete Code Example

Check out our complete demo project at Imprint-Tech/imprint-sdk-ios
import Imprint

class YourViewController: UIViewController {

  // …
  
  func startImprintApplication() {
    let configuration = ImprintConfiguration(clientSecret: "client_secret", partnerReference: "partner_reference", environment: .sandbox)
    
    // Define the completion handler
    configuration.onCompletion = { state, data in
      switch state {
      case .offerAccepted:
        print("Offer accepted, data: \(String(describing: data))")
      case .rejected:
        print("Application rejected, data: \(String(describing: data))")
      case .inProgress:
        print("Incomplete application, data: \(String(describing: data))")
      case .error:
        print("Error occurred, data: \(String(describing: data))")
      }
      // Perform any generic actions after the flow ends if needed
    }
    
    ImprintApp.startApplication(from: self, configuration: configuration)
  }
}
Request Parameters
PROPERTY NAMESREQUIREDTYPEDESCRIPTION
client_secretTRUEStringGenerated through Create Customer Session
partnerReferenceTRUEStringThe unique reference identifier for the partner
Response Data
PROPERTY NAMESTYPEDESCRIPTION
customer_idString | nullImprint identifier for customer
partner_customer_idString | nullPartner identifier for customer
payment_method_idString | nullID to the payment method of customer
error_codeErrorCode | nullIdentifier for the specific error encountered
ErrorCode (Enum)
ENUMDESCRIPTION
INVALID_CLIENT_SECRETIndicate Client Secret is invalid
UNKNOWN_ERRORIndicate other unexpected error happened
Application States
ENUMDESCRIPTION
offerAcceptedApplication has been approved and credit offer accepted. New cardholder!
rejectedApplication has been rejected by Imprint
inProgressApplication has been exited, not completed
errorInvalid request parameters (e.g., invalid token)