Sep31CustomerInfoNeededException

class Sep31CustomerInfoNeededException(val type: String?, val rawResponseBody: String? = null) : Sep31Exception

Exception thrown when the Receiving Anchor needs additional SEP-12 KYC information.

Raised exclusively from POST /transactions when the anchor responds with HTTP 400 and error == "customer_info_needed". The type field, when present, names the specific SEP-12 customer type the Sending Anchor must collect (matching a key from the sep12.sender.types or sep12.receiver.types map in the GET /info response).

Resolution workflow:

  1. Inspect type to determine which SEP-12 customer type to collect.

  2. Call SEP-12 PUT /customer with the missing KYC fields.

  3. Use the returned id as sender_id or receiver_id in the SEP-31 request.

  4. Retry POST /transactions with the updated request body.

The exception message interpolates the anchor-supplied type after passing it through the project-wide sanitizer so log-injection and terminal-escape payloads cannot reach application logs via the exception text. The type property itself is exposed unsanitized for programmatic use by the caller.

Example - Handle customer-info-needed:

try {
val response = sep31Service.postTransactions(request, jwt)
} catch (e: Sep31CustomerInfoNeededException) {
println("SEP-12 KYC required; collect fields for type=${e.type}")
// Submit SEP-12 PUT /customer with the missing fields, then retry.
}

See also:

Constructors

Link copied to clipboard
constructor(type: String?, rawResponseBody: String? = null)

Properties

Link copied to clipboard
expect open val cause: Throwable?
Link copied to clipboard

The literal error tag returned by the Receiving Anchor for this condition.

Link copied to clipboard
expect open val message: String?
Link copied to clipboard

Anchor response body for local debugging — see the rawResponseBody convention on Sep31Exception. null when no body was captured.

Link copied to clipboard
val type: String?

The SEP-12 customer type the Sending Anchor must collect, or null if the anchor did not specify one.

Functions

Link copied to clipboard
open override fun toString(): String