Launch Feature
Launch Feature Request
The launch feature flow is initiated by calling FeatureManager.launchFeature() with a FeatureRequest built via the Builder API. Unlike verify(), launchFeature() requires featureId to identify which feature to launch, and does not perform a credential exchange.
val request = FeatureRequest.Builder()
.requestId("REQ-${System.currentTimeMillis()}")
.featureId("some-feature-id")
.userCorrelationId("corr-5678")
.token("host-app-token")
.build()| Field name | Description |
|---|---|
| requestId | Unique identifier for the request, generated by the client. Required — FeatureCallback.onError(GPE-2206) is invoked if blank. |
| featureId | Identifier of the feature to launch. Required — FeatureCallback.onError(GPE-2206) is invoked if blank. |
| userCorrelationId | Identifier linking the client user to GoPay. Required — FeatureCallback.onError(GPE-2206) is invoked if blank. |
| token | The linking token for the user. Required — FeatureCallback.onError(GPE-2206) is invoked if blank. |
| additionalData | Optional key-value metadata forwarded to the backend, same as verify(). Pass null if not required. |
Note:
FeatureRequest.build()does not validate fields. Validation happens insidelaunchFeature()—featureId,userCorrelationId,requestId, andtokenare all required; missing any of them results inFeatureCallback.onErrorbeing called withGPE-2206, not an exception.
Launch Feature Response
FeatureCallback.onComplete is invoked with a LaunchResult upon completion of the flow.
data class LaunchResult(
val featureId: String
)| Field | Description |
|---|---|
| featureId | Echoes back the identifier of the feature that was launched. |
Example Usage
val request = FeatureRequest.Builder()
.requestId("REQ-${System.currentTimeMillis()}")
.featureId("some-feature-id")
.userCorrelationId("corr-5678")
.token("host-app-token")
.build()
sdk.getFeatureManager().launchFeature(
activity = this,
request = request,
callback = object : FeatureCallback<LaunchResult> {
override fun onComplete(result: LaunchResult, data: Map<String, Any?>) {
Log.d(TAG, "Launched featureId: ${result.featureId}")
}
override fun onError(error: GoPayEnterpriseError) {
Log.e(TAG, "${error.code}: ${error.message}")
}
}
)Usage Notes
build()does not throw — validation is performed insidelaunchFeature(). EnsurefeatureId,userCorrelationId,requestId, andtokenare all non-blank before calling.featureIdmust be whitelisted for yourclientID; otherwiseFeatureCallback.onErroris invoked withGPE-2204.- Unlike
verify(),launchFeature()does not take aCredentialReceiver— no auth-code exchange is performed. - Generate a fresh
requestIdfor everylaunchFeature()call, the same as forverify(). - The
dataparameter inonCompletemay carry additional SDK metadata; it can safely be ignored if not needed. - Always call
launchFeature()from the main thread.
Updated 3 days ago
Did this page help you?