Feature Manager
public protocol FeatureManager: AnyObject {
func verify(
viewController: UIViewController,
request: FeatureRequest,
credentialReceiver: CredentialReceiver,
callback: AnyFeatureCallback<VerifyResult>
) throws
func login(
viewController: UIViewController,
request: FeatureRequest,
credentialReceiver: CredentialReceiver,
callback: AnyFeatureCallback<LoginResult>
) throws
}
public protocol FeatureCallback: AnyObject {
associatedtype Result
func onComplete(result: Result, data: [String: Any])
func onError(error: GoPayEnterpriseError)
}| Terminology | Description |
|---|---|
| requestId | Request identifier generated by the client before initiating any flow via Enterprise SDK. |
| userCorrelationId | Identifier linking the client user to GoPay, obtained from the credential exchange. |
| token | The linking token for the user — short-term when an exchange is required, long-term when it is not. |
verify
Launches the GoPay verify flow inside the provided UIViewController. Validates the request internally and calls callback.onError (code GPE-2206) if required fields are missing rather than throwing.
| Parameter | Type | Description |
|---|---|---|
| viewController | UIViewController | The view controller from which the SDK UI will be presented. |
| request | FeatureRequest | Built via FeatureRequest.Builder. Contains requestId, userCorrelationId, and token. |
| credentialReceiver | CredentialReceiver | Controls how the SDK handles the auth-code handshake. Use .exchange for a short-term linking token or .none for a long-term token. |
| callback | AnyFeatureCallback<VerifyResult> | Receives onComplete(result:data:) with a VerifyResult on success, or onError(error:) on failure. |
For a detailed usage guide, see Verify with GoPay.
login
Status: Not yet implemented. This method is reserved for the Login with GoPay flow and will be available in a future release. Calling it currently triggers a
fatalError.
FeatureCallback
FeatureCallback is a protocol with an associated Result type. Because Swift protocols with associated types cannot be stored directly, the SDK provides a type-erased wrapper AnyFeatureCallback<R> for passing callbacks through the API.
public protocol FeatureCallback: AnyObject {
associatedtype Result
func onComplete(result: Result, data: [String: Any])
func onError(error: GoPayEnterpriseError)
}
public final class AnyFeatureCallback<R> {
public init<C: FeatureCallback>(wrapping callback: C) where C.Result == R
public func onComplete(result: R, data: [String: Any] = [:])
public func onError(error: GoPayEnterpriseError)
}Create a concrete class conforming to FeatureCallback, then wrap it with AnyFeatureCallback(wrapping:) when passing to SDK methods.
final class VerifyFeatureCallback: FeatureCallback {
typealias Result = VerifyResult
func onComplete(result: VerifyResult, data: [String: Any]) {
print("Submission ID: \(result.submissionId)")
}
func onError(error: GoPayEnterpriseError) {
print("Error [\(error.code)]: \(error.message)")
}
}
let callback = VerifyFeatureCallback()
try sdk.getFeatureManager().verify(
viewController: self,
request: request,
credentialReceiver: credentialReceiver,
callback: AnyFeatureCallback(wrapping: callback)
)Important: Keep a strong reference to your
FeatureCallbackinstance for the duration of the flow.AnyFeatureCallbackholds only a weak reference to the wrapped callback.
Updated about 13 hours ago