putTransactionCallback

suspend fun putTransactionCallback(id: String, callbackUrl: String, jwt: String)

Registers a callback URL the Receiving Anchor will invoke when the transaction status changes.

The callbackUrl is validated against the HTTPS requirement before the JWT is sent on the wire. The anchor may indicate that callback registration is not supported by returning HTTP 404; that path raises Sep31TransactionCallbackNotSupportedException (distinct from Sep31TransactionNotFoundException, which signals an unknown transaction id).

Callback signature verification is the Sending Anchor application's responsibility per spec. Use com.soneso.stellar.sdk.sep.common.CallbackSignatureVerifier to verify inbound Signature (or legacy X-Stellar-Signature) headers against the Receiving Anchor's SIGNING_KEY; the verifier handles header parsing, canonical payload assembly, timestamp freshness, and Ed25519 verification.

Example:

sep31Service.putTransactionCallback(
id = "11111111-1111-1111-1111-111111111111",
callbackUrl = "https://sending-anchor.example.org/sep31-callback",
jwt = jwtToken
)

Parameters

id

Transaction identifier returned by postTransactions.

callbackUrl

HTTPS URL the anchor will POST status updates to. HTTP is accepted only against the loopback authorities localhost, 127.0.0.1, or [::1] (each optionally with a port).

jwt

SEP-10 authentication token.

Throws

if id fails path-segment validation or callbackUrl is neither HTTPS nor HTTP against a loopback authority.

on any other HTTP status code.