Sep08PostTransactionResponse

Represents the response from a SEP-8 approval server when a transaction is submitted for regulatory approval via the postTransaction endpoint.

The approval server evaluates the submitted transaction and returns one of five possible outcomes, each modeled as a subclass of this sealed class. The response type is determined by the status field in the JSON response.

Response Types

  • Success: The transaction was approved and is ready for submission to the network.

  • Revised: The transaction was modified by the approval server (e.g., additional operations added) and the revised version should be submitted instead.

  • Pending: The approval server needs more time to evaluate the transaction. The client should resubmit after the specified timeout.

  • ActionRequired: The user must complete an additional action (e.g., KYC verification) before the transaction can be approved.

  • Rejected: The transaction was rejected and cannot be approved.

Usage

val json = Json.parseToJsonElement(responseBody).jsonObject
val response = Sep08PostTransactionResponse.fromJson(json)

when (response) {
is Sep08PostTransactionResponse.Success -> {
// Submit response.tx to the Stellar network
}
is Sep08PostTransactionResponse.Revised -> {
// Review response.tx and response.message, then submit
}
is Sep08PostTransactionResponse.Pending -> {
// Wait response.timeout milliseconds, then resubmit
}
is Sep08PostTransactionResponse.ActionRequired -> {
// Direct user to response.actionUrl
}
is Sep08PostTransactionResponse.Rejected -> {
// Display response.error to the user
}
}

See also

Inheritors

Types

Link copied to clipboard
data class ActionRequired(val message: String, val actionUrl: String, val actionMethod: String = "GET", val actionFields: List<String>? = null) : Sep08PostTransactionResponse

The user must complete an action before the transaction can be approved.

Link copied to clipboard
object Companion
Link copied to clipboard
data class Pending(val timeout: Int = 0, val message: String? = null) : Sep08PostTransactionResponse

The approval server needs more time to process the transaction.

Link copied to clipboard

The transaction was rejected by the approval server.

Link copied to clipboard
data class Revised(val tx: String, val message: String) : Sep08PostTransactionResponse

The transaction was revised by the approval server.

Link copied to clipboard
data class Success(val tx: String, val message: String? = null) : Sep08PostTransactionResponse

The transaction was approved by the approval server without modifications.