Initialization

public enum GoPayEnterpriseEnvironment {
    case STAGING, PRODUCTION
}

public enum GoPayEnterpriseLocale: String {
    case id, en
}

public struct GoPayEnterpriseConfiguration {
    var clientID: String
    var environment: GoPayEnterpriseEnvironment
    var enableDebugLogs: Bool
    var additionalData: [String: String]?
    var locale: GoPayEnterpriseLocale

    public init(
        clientID: String,
        environment: GoPayEnterpriseEnvironment,
        enableDebugLogs: Bool = false,
        additionalData: [String: String]? = nil,
        locale: GoPayEnterpriseLocale = .en
    )
}

public protocol GoPayEnterpriseCallbackDelegate: AnyObject {
    func onDismiss()
    func onFailure(error: GoPayEnterpriseError)
}

public struct GoPayEnterpriseError: Error {
    public var code: String
    public var message: String
    public var title: String
}

public enum GoPayEnterpriseFactory {
    public static func createEnterpriseSdk(
        configuration: GoPayEnterpriseConfiguration,
        callbackDelegate: GoPayEnterpriseCallbackDelegate
    ) -> GoPayEnterpriseSdk
}

public protocol GoPayEnterpriseSdk: AnyObject {
    func getFeatureManager() -> FeatureManager
    func getKycManager() -> KycManager
    func logout()
}

Specifications

GoPayEnterpriseFactory

public enum GoPayEnterpriseFactory {
    public static func createEnterpriseSdk(
        configuration: GoPayEnterpriseConfiguration,
        callbackDelegate: GoPayEnterpriseCallbackDelegate
    ) -> GoPayEnterpriseSdk
}

Description

Initializes the GoPay Enterprise SDK with the provided configuration and returns the entry-point GoPayEnterpriseSdk instance.

Parameters

ParameterTypeDescription
configurationGoPayEnterpriseConfigurationThe SDK configuration object. Contains clientID, environment, locale, debug log settings, and optional additionalData.
callbackDelegateGoPayEnterpriseCallbackDelegateA weakly-held delegate that receives top-level SDK events: dismissal and initialization or runtime failures.

Return Value

Returns a GoPayEnterpriseSdk instance. Store this instance for the lifetime of the user session — it is the entry point for all subsequent SDK operations.

Usage Notes

  • Call once before invoking any other SDK method.
  • If initialization fails (e.g. invalid clientID), callbackDelegate.onFailure is called with a GoPayEnterpriseError.
  • Always set enableDebugLogs to false in production builds to avoid leaking sensitive request/response data.
  • The delegate is held weakly — ensure the object conforming to GoPayEnterpriseCallbackDelegate is retained by your view controller or coordinator.
  • Call createEnterpriseSdk again only after logout() or when a new configuration is required.
  • Call on the main thread.

Example Usage

let configuration = GoPayEnterpriseConfiguration(
    clientID: "YOUR_CLIENT_ID",
    environment: .STAGING,
    enableDebugLogs: true,
    additionalData: nil,
    locale: .en
)

let sdk = GoPayEnterpriseFactory.createEnterpriseSdk(
    configuration: configuration,
    callbackDelegate: self
)
extension MyViewController: GoPayEnterpriseCallbackDelegate {
    func onDismiss() {
        // SDK container was dismissed
    }

    func onFailure(error: GoPayEnterpriseError) {
        print("SDK error [\(error.code)]: \(error.title) — \(error.message)")
    }
}

Field Reference

GoPayEnterpriseConfiguration

An object containing configuration parameters required to initialize the GoPay Enterprise SDK.

ParameterTypeDescription
clientIDStringUnique identifier provided by GoPay as part of your SDK integration.
environmentGoPayEnterpriseEnvironmentDetermines the environment. Use .STAGING for development and testing; .PRODUCTION before going live.
enableDebugLogsBoolEnables verbose console logging. Always false in production builds.
localeGoPayEnterpriseLocaleSets the display language of SDK UI. .en for English (default), .id for Bahasa Indonesia.
additionalData[String: String]?Optional key-value pairs forwarded to the backend for validations or security enhancements. Pass nil if not required.

GoPayEnterpriseCallbackDelegate

A protocol implemented by the host app to receive top-level SDK lifecycle events.

MethodDescription
onDismiss()Called when the SDK container is closed or popped from the navigation stack.
onFailure(error: GoPayEnterpriseError)Called when the SDK encounters an initialization or runtime failure. Inspect error.code for details.

GoPayEnterpriseError

Represents an error returned by the SDK.

FieldTypeDescription
codeStringError constant identifying the specific failure. See Error Codes Reference.
messageStringLocalized, human-readable error message.
titleStringLocalized error title.

GoPayEnterpriseSDK

GoPayEnterpriseSdk is the main handle for the SDK. It provides access to feature and KYC flows, and session management.

FunctionDescription
getFeatureManagerReturns a FeatureManager instance for launching verify and login flows.
getKycManagerReturns a KycManager instance for KTP scan, selfie liveness, selfie verification, and full KYC.
logoutClears cached credential state and ends the current session.

logout

func logout()

Clears any cached authentication tokens and user-related state from the SDK.

Parameters: None

Return Value: None

Usage Notes:

  • Call when the user signs out of your application or when session invalidation is required.
  • After calling logout(), call GoPayEnterpriseFactory.createEnterpriseSdk again before making further SDK calls.
sdk.logout()