What's New

Release v1.0.0 (2024-05-17)


Hellgate® iOS SDK

Official release of Hellgate® iOS SDK:

  • Cardholder Data tokenization
  • Support Card Number, CVC, Expiration Date
  • Support Additional Fields to capture information about the cardholder

Hellgate iOS SDK


The Hellgate iOS SDK is distributed via Cocoapods, Carthage and SPM.


Add the following line to your Podfile:

pod 'Hellgate-iOS-SDK'


  1. Add the following line to your Cartfile:
github "starfish-codes/hgate2-ios-headless-sdk"
  1. Run in same directory as your Cartfile:
$ carthage update --use-xcframeworks
  1. Add the built XCFrameworks to your project under "Frameworks and Libraries"

Swift Package Manager

Add the package via Xcode from https://github.com/starfish-codes/hgate2-ios-headless-sdk.git



import Hellgate-iOS-SDK

UI Fields

Use the following views to create a card form:

// Card number field, validation state and which side should the card images appear
CardNumberView(viewState: $viewModel.cardNumberViewState, image: .leading)

// Expiry date field, validation state
ExpiryDateView(viewState: $viewModel.expiryViewState)

// CVC and CVV view with view state and max length either .cvc or .cvv
CvcView(viewState: $viewModel.cvcViewState, length: .cvc)

Each field has a ViewState which looks somewhat like this:

public enum ComponentState: String {
    case complete
    case incomplete
    case blank
    case invalid

public struct ViewState {
    public let state: ComponentState

The ViewStates can help to determine how the user is progressing in filling out the fields.


First we have to initialize a Hellgate session using the sessionId delivered from your backend.

let hellgate = await initHellgate(baseUrl: hellgateURL, sessionId: sessionId)

Next we need to get a card handler from the Hellgate session and then we can try and tokenize the card details based on the view states previously defined in the UI.

// First try to get a valid card handler
let cardHandlerResult = await hellgate.cardHandler()

if case let .success(handler) = cardHandlerResult {

    // Using the card handler and the previously defined view states
    // try and tokenize the card

    let tokenizeCardResult = await handler.tokenizeCard(

    switch tokenizeCardResult {
    case let .success(data):
        // Results in a token id

    case let .failure(err):



If swiftlint is installed then it will run during the build process.

Code Coverage

  • Minmimum code coverage is 60%


If you are having trouble integrating the Hellgate iOS SDK into your project(s), please email hellgate.products@starfish.team.

Any requests, issues or bugs, please feel free to open an issue.

Feel free to open up a pull request if you have fixed any issues and we will look into it. Please follow any development practices/processes mentioned in this document and in any Github workflows.

Thank you for contributing.


  • Swift Tools 5.5.0
View More Packages from this Author


  • None
Last updated: Sun Jun 02 2024 05:22:42 GMT-0900 (Hawaii-Aleutian Daylight Time)