Saltar al contenido principal
Versión: 2,8
SEP-31SEP-38

Retrieve Rates

GET 

/rate

Transactions that involve two non-equivalent on & off-chain assets (such as USDC on Stellar and fiat EUR) must use exchange rates that are communicated to the client application requesting the transaction. When clients make requests to the Platform for these exchange rates, the Platform sends this request to the anchor to fetch it.

Rates can be indicative or firm. The anchor must provide an ID and expiration if the client requests a firm rate.

Anchors can provide discounted rates specific client applications. The Platform includes the client_id parameter for this reason.

Either sell_amount or buy_amount will be included in requests as parameters, but never both. In the same way, either sell_delivery_method and buy_delivery_method may be included in requests, but never both, since either sell_asset or buy_asset is a Stellar asset.

Request

Query Parameters

    type stringrequired

    Possible values: [indicative, firm]

    The type of rate requested. If firm, the response must include rate.id and rate.expires_at.

    client_id string

    An identifier for the client application making the request. This ID can be used to offer different fees to different clients.

    Client IDs will be the Stellar public key the public key used to authenticate via SEP-10. Anchors must ensure that the public key specified in the request matches a public key known to belong to the sending anchor.

    This parameter will only be specified if the client is authenticated via SEP-10. Anchors can define whether or not authentication is required for fetching indicative rates. Firm rates always require authentication.

    sell_asset stringrequired

    The asset the client application will send to the anchor in exchange for buy_asset in Asset Identification Format.

    buy_asset stringrequired

    The asset the that the anchor will send in exchange for sell_asset in Asset Identification Format.

    sell_amount string

    The amount of sell_asset the client application will send in exchange for buy_asset. Will not be used in conjuction with buy_amount.

    buy_amount string

    The amount of buy_asset the anchor will send in exchange for sell_asset. Will not be used in conjuction with sell_amount.

    country_code string

    The ISO 3166-1 alpha-3 code of the user's current address. Anchors should expect this parameter to be provided if one of the assets of the buy/sell pair is fiat and it is available in two or more countries.

    expire_after string

    The client's desired expires_at date and time for the quote that can be used if this is a firm quote. This should be a UTC ISO 8601 string. Anchors should return 400 Bad Request if an expiration date on or after the requested value cannot be provided.

    sell_delivery_method string

    The method the client or user will use to deliver sell_asset to the Anchor. This value may affect the expiration and price provided. The values used for this parameter is defined in the application's configuration. Will not be used in conjuction with buy_delivery_method.

    buy_delivery_method string

    The method the client or user wants used to receive buy_asset from the Anchor. This value may affect the expiration and price provided. The values used for this parameter is defined in the application's configuration. Will not be used in conjuction with sell_delivery_method.

Responses

Success.
Schema

    rate

    object

    id string

    ID of the firm quote. NOT USED when type=indicative.

    expires_at date-time

    Expiration for the quote. NOT USED when type=indicative.

    price stringrequired

    The conversion price offered by the anchor for one unit of buy_asset in terms of sell_asset, without including fees. In traditional finance, buy_asset would be referred to as the base asset and sell_asset as the counter asset. The formula sell_amount - fee = price * buy_amount must hold true (ref).

    sell_amount stringrequired

    The amount of sell_asset the anchor will exchange for buy_asset. It could be different from the sell_amount provided in the request, depending on how fees are applied by the Anchor.

    buy_amount stringrequired

    The amount of buy_asset the anchor will provide with sell_asset. It could be different from the buy_amount provided in the request, depending on how fees are applied by the Anchor.

    fee

    object

    An object describing the fees added on top of the rate provided via the price attribute.

    total stringrequired

    The total fee to be applied.

    asset stringrequired

    The asset the fee will be charged in. Must be represented in Asset Identification Format.

    details

    object[]

  • Array [

  • name stringrequired

    The name of the fee, for example ACH fee, Brazilian conciliation fee, Service fee, etc.

    description string

    A text describing the fee.

    amount stringrequired

    The amount of asset applied. If fee.details is provided, sum(fee.details.amount) should be equals fee.total.

  • ]

Loading...