withdraw Exchange
Initiates a programmatic withdrawal with asset conversion (SEP-38 exchange).
A withdrawal exchange allows a user to send a Stellar asset to an anchor and receive a different off-chain asset in return. For example, sending USDC on Stellar and receiving EUR in a bank account.
Return
Sep06WithdrawResponse with withdrawal instructions (anchor account, memo)
Parameters
request
Withdrawal exchange request parameters
Throws
If JWT is invalid or expired
If additional KYC fields are required
If KYC status prevents the transaction
On validation error
On anchor server error
Example:
val response = sep06.withdrawExchange(Sep06WithdrawExchangeRequest(
sourceAsset = "USDC",
destinationAsset = "iso4217:EUR",
amount = "100",
type = "bank_account",
jwt = jwtToken,
quoteId = quote.id,
dest = "DE89370400440532013000"
))
println("Send to: ${response.accountId}")Content copied to clipboard