WithdrawExchangeRequest
in package
Request parameters for cross-asset withdrawal with SEP-38 quote support.
Encapsulates parameters for withdrawal operations involving currency conversion. Enables users to send one Stellar asset (e.g., USDC) and receive a different off-chain asset (e.g., NGN to bank account). Requires anchor support for SEP-38 quotes to determine exchange rates.
Required fields include sourceAsset (Stellar asset to withdraw), destinationAsset (off-chain asset to receive), amount, and type. Optional quote_id locks in exchange rates.
Tags
Table of Contents
Properties
- $account : string|null
- $amount : string
- $countryCode : string|null
- $customerId : string|null
- $dest : string|null
- $destExtra : string|null
- $destinationAsset : string
- $extraFields : array<string, string>|null
- $jwt : string|null
- $lang : string|null
- $locationId : string|null
- $memo : string|null
- $memoType : string|null
- $onChangeCallback : string|null
- $quoteId : string|null
- $refundMemo : string|null
- $refundMemoType : string|null
- $sourceAsset : string
- $type : string
- $walletName : string|null
- $walletUrl : string|null
Methods
- __construct() : mixed
Properties
$account
public
string|null
$account
= null
(optional) The Stellar or muxed account the client will use as the source of the withdrawal payment to the anchor. If SEP-10 authentication is not used, the anchor can use account to look up the user's KYC information. Note that the account specified in this request could differ from the account authenticated via SEP-10.
$amount
public
string
$amount
The amount of the on-chain asset (source_asset) the user would like to send to the anchor's Stellar account. This field may be necessary for the anchor to determine what KYC information is necessary to collect. Should be equals to quote.sell_amount if a quote_id was used.
$countryCode
public
string|null
$countryCode
= null
(optional) The ISO 3166-1 alpha-3 code of the user's current address (e.g., 'USA' for United States, 'GBR' for United Kingdom, 'DEU' for Germany). This field may be necessary for the anchor to determine what KYC information is necessary to collect.
$customerId
public
string|null
$customerId
= null
(optional) id of an off-chain account (managed by the anchor) associated with this user's Stellar account (identified by the JWT's sub field). If the anchor supports SEP-12, the customer_id field should match the SEP-12 customer's id. customer_id should be passed only when the off-chain id is know to the client, but the relationship between this id and the user's Stellar account is not known to the Anchor.
$dest
public
string|null
$dest
= null
(Deprecated) The account that the user wants to withdraw their funds to. This can be a crypto account, a bank account number, IBAN, mobile number, or email address.
$destExtra
public
string|null
$destExtra
= null
(Deprecated, optional) Extra information to specify withdrawal location. For crypto it may be a memo in addition to the dest address. It can also be a routing number for a bank, a BIC, or the name of a partner handling the withdrawal.
$destinationAsset
public
string
$destinationAsset
The off-chain asset the Anchor will deliver to the user's account. The value must match one of the asset values included in a SEP-38 GET /prices?sell_asset=stellar:<source_asset>:<asset_issuer> response using SEP-38 Asset Identification Format.
$extraFields
public
array<string, string>|null
$extraFields
= null
(optional) can be used to provide extra fields for the request. E.g. required fields from the /info endpoint that are not covered by the standard parameters.
$jwt
public
string|null
$jwt
= null
jwt token previously received from the anchor via the SEP-10 authentication flow.
$lang
public
string|null
$lang
= null
(optional) Defaults to en if not specified or if the specified language is not supported. Language code specified using RFC 4646 (e.g., 'en' for English, 'es' for Spanish, 'pt-BR' for Brazilian Portuguese). Error fields and other human readable messages in the response should be in this language.
$locationId
public
string|null
$locationId
= null
(optional) id of the chosen location to pick up cash.
$memo
public
string|null
$memo
= null
(optional) This field should only be used if SEP-10 authentication is not. It was originally intended to distinguish users of the same Stellar account. However if SEP-10 is supported, the anchor should use the sub value included in the decoded SEP-10 JWT instead.
$memoType
public
string|null
$memoType
= null
(deprecated, optional) Type of memo. One of text, id or hash. Deprecated because memos used to identify users of the same Stellar account should always be of type of id.
$onChangeCallback
public
string|null
$onChangeCallback
= null
(optional) A URL that the anchor should POST a JSON message to when the status property of the transaction created as a result of this request changes. The JSON message should be identical to the response format for the /transaction endpoint.
$quoteId
public
string|null
$quoteId
= null
(optional) The id returned from a SEP-38 POST /quote response. If this parameter is provided and the Stellar transaction used to send the asset to the Anchor has a created_at timestamp earlier than the quote's expires_at attribute, the Anchor should respect the conversion rate agreed in that quote. If the values of destination_asset, source_asset and amount conflict with the ones used to create the SEP-38 quote, this request should be rejected with a 400.
$refundMemo
public
string|null
$refundMemo
= null
(optional) The memo the anchor must use when sending refund payments back to the user. If not specified, the anchor should use the same memo used by the user to send the original payment. If specified, refundMemoType must also be specified.
$refundMemoType
public
string|null
$refundMemoType
= null
(optional) The type of the refund_memo. Can be id, text, or hash. If specified, refundMemo must also be specified.
$sourceAsset
public
string
$sourceAsset
Code of the on-chain asset the user wants to withdraw. The value passed must match one of the codes listed in the /info response's withdraw-exchange object.
$type
public
string
$type
Type of withdrawal. Can be: crypto, bank_account, cash, mobile, bill_payment or other custom values. This field may be necessary for the anchor to determine what KYC information is necessary to collect.
$walletName
public
string|null
$walletName
= null
(deprecated, optional) In communications / pages about the withdrawal, anchor should display the wallet name to the user to explain where funds are coming from. However, anchors should use client_domain (for non-custodial) and sub value of JWT (for custodial) to determine wallet information.
$walletUrl
public
string|null
$walletUrl
= null
(deprecated, optional) Anchor can show this to the user when referencing the wallet involved in the withdrawal (ex. in the anchor's transaction history). However, anchors should use client_domain (for non-custodial) and sub value of JWT (for custodial) to determine wallet information.
Methods
__construct()
public
__construct(string $sourceAsset, string $destinationAsset, string $amount, string $type[, string|null $dest = null ][, string|null $destExtra = null ][, string|null $quoteId = null ][, string|null $account = null ][, string|null $memo = null ][, string|null $memoType = null ][, string|null $walletName = null ][, string|null $walletUrl = null ][, string|null $lang = null ][, string|null $onChangeCallback = null ][, string|null $countryCode = null ][, string|null $refundMemo = null ][, string|null $refundMemoType = null ][, string|null $customerId = null ][, string|null $locationId = null ][, array<string, string>|null $extraFields = null ][, string|null $jwt = null ]) : mixed
Parameters
- $sourceAsset : string
-
Code of the on-chain asset the user wants to withdraw. The value passed must match one of the codes listed in the /info response's withdraw-exchange object.
- $destinationAsset : string
-
The off-chain asset the Anchor will deliver to the user's account. The value must match one of the asset values included in a SEP-38 GET /prices?sell_asset=stellar:<source_asset>:<asset_issuer> response using SEP-38 Asset Identification Format.
- $amount : string
-
The amount of the on-chain asset (source_asset) the user would like to send to the anchor's Stellar account. This field may be necessary for the anchor to determine what KYC information is necessary to collect. Should be equals to quote.sell_amount if a quote_id was used.
- $type : string
-
Type of withdrawal. Can be: crypto, bank_account, cash, mobile, bill_payment or other custom values. This field may be necessary for the anchor to determine what KYC information is necessary to collect.
- $dest : string|null = null
-
(deprecated) The account that the user wants to withdraw their funds to. This can be a crypto account, a bank account number, IBAN, mobile number, or email address.
- $destExtra : string|null = null
-
(deprecated, optional) Extra information to specify withdrawal location. For crypto it may be a memo in addition to the dest address. It can also be a routing number for a bank, a BIC, or the name of a partner handling the withdrawal.
- $quoteId : string|null = null
-
(optional) The id returned from a SEP-38 POST /quote response. If this parameter is provided and the Stellar transaction used to send the asset to the Anchor has a created_at timestamp earlier than the quote's expires_at attribute, the Anchor should respect the conversion rate agreed in that quote. If the values of destination_asset, source_asset and amount conflict with the ones used to create the SEP-38 quote, this request should be rejected with a 400.
- $account : string|null = null
-
(optional) The Stellar or muxed account the client will use as the source of the withdrawal payment to the anchor. If SEP-10 authentication is not used, the anchor can use account to look up the user's KYC information. Note that the account specified in this request could differ from the account authenticated via SEP-10.
- $memo : string|null = null
-
(optional) This field should only be used if SEP-10 authentication is not. It was originally intended to distinguish users of the same Stellar account. However if SEP-10 is supported, the anchor should use the sub value included in the decoded SEP-10 JWT instead.
- $memoType : string|null = null
-
(deprecated, optional) Type of memo. One of text, id or hash. Deprecated because memos used to identify users of the same Stellar account should always be of type of id.
- $walletName : string|null = null
-
(deprecated, optional) In communications / pages about the withdrawal, anchor should display the wallet name to the user to explain where funds are coming from. However, anchors should use client_domain (for non-custodial) and sub value of JWT (for custodial) to determine wallet information.
- $walletUrl : string|null = null
-
(deprecated, optional) Anchor can show this to the user when referencing the wallet involved in the withdrawal (ex. in the anchor's transaction history). However, anchors should use client_domain (for non-custodial) and sub value of JWT (for custodial) to determine wallet information.
- $lang : string|null = null
-
(optional) Defaults to en if not specified or if the specified language is not supported. Language code specified using RFC 4646. error fields and other human readable messages in the response should be in this language.
- $onChangeCallback : string|null = null
-
(optional) A URL that the anchor should POST a JSON message to when the status property of the transaction created as a result of this request changes. The JSON message should be identical to the response format for the /transaction endpoint.
- $countryCode : string|null = null
-
(optional) The ISO 3166-1 alpha-3 code of the user's current address (e.g., 'USA' for United States, 'GBR' for United Kingdom, 'DEU' for Germany). This field may be necessary for the anchor to determine what KYC information is necessary to collect.
- $refundMemo : string|null = null
-
(optional) The memo the anchor must use when sending refund payments back to the user. If not specified, the anchor should use the same memo used by the user to send the original payment. If specified, refundMemoType must also be specified.
- $refundMemoType : string|null = null
-
(optional) The type of the refund_memo. Can be id, text, or hash. If specified, refundMemo must also be specified.
- $customerId : string|null = null
-
(optional) id of an off-chain account (managed by the anchor) associated with this user's Stellar account (identified by the JWT's sub field). If the anchor supports SEP-12, the customer_id field should match the SEP-12 customer's id. customer_id should be passed only when the off-chain id is know to the client, but the relationship between this id and the user's Stellar account is not known to the Anchor.
- $locationId : string|null = null
-
(optional) id of the chosen location to pick up cash
- $extraFields : array<string, string>|null = null
-
(optional) can be used to provide extra fields for the request. E.g. required fields from the /info endpoint that are not covered by the standard parameters.
- $jwt : string|null = null
-
jwt previously received from the anchor via the SEP-10 authentication flow