> ## Documentation Index
> Fetch the complete documentation index at: https://docs.localpayment.com/llms.txt
> Use this file to discover all available pages before exploring further.

# 获取外汇报价

此接口生成安全的货币兑换报价，锁定汇率、有效期以及用于支付处理的唯一令牌。默认情况下，报价每 60 秒刷新一次，但也可根据您的运营需求，提供从每分钟到每天的自定义刷新频率。
\
&#x20;**支持的用例：**\
&#x20; \- **Payin (DCC)**  ：在向您的用户收款之前锁定汇率。\
&#x20; \- **Payout (DCC)**  ：在向收款人付款之前锁定汇率。\
&#x20; \- **Bulk Exchange**  ：在您自己的账户之间兑换资金之前锁定汇率。\
&#x20;  有关何时以及为何使用各个选项的完整说明，请参阅[外汇概览](https://docs.localpayment.com/zh/docs/fx-overview.md)。


## OpenAPI

````yaml openapi/zh/localpayment.json GET /api/fx/currency-exchange/{type}
openapi: 3.1.0
info:
  version: '1.0'
  title: Localpayment
  contact:
    name: Support
    url: mailto:support@localpayment.com
servers:
  - url: https://api.stage.localpayment.com
    description: Stage
security:
  - token: []
paths:
  /api/fx/currency-exchange/{type}:
    get:
      summary: 获取外汇报价
      operationId: currency-exchange-quote
      parameters:
        - name: Authorization
          in: header
          description: >-
            用于身份验证的 Bearer
            访问令牌。该令牌可从[获取访问令牌](/zh/reference/get-token)或[刷新访问令牌](/zh/reference/refresh-token)endpoint
            获取。
          required: true
          schema:
            type: string
        - name: sourceCurrency
          in: query
          description: 您要转换**自**的货币。[货币代码](/zh/reference/currency-codes)。支持稳定币 USDC 和 USDT。
          required: true
          schema:
            type: string
            examples:
              - ARS
        - name: quoteCurrency
          in: query
          description: 您要转换**为**的货币。[货币代码](/zh/reference/currency-codes)。
          required: true
          schema:
            type: string
            examples:
              - USD
        - name: accountNumber
          in: query
          description: 您的 Localpayment 账户，用于持有**源货币**（即待扣款账户）。必须与 `quoteAccountNumber` 不同。
          required: true
          schema:
            type: string
            examples:
              - '{{accountNumber}}'
        - name: quoteAccountNumber
          in: query
          description: 您的 Localpayment 账户，用于持有**目标货币**（即收款账户）。必须与 `accountNumber` 不同。
          required: true
          schema:
            type: string
        - name: type
          in: path
          description: 交易类型。
          required: true
          schema:
            type: string
            enum:
              - payin
              - payout
              - CurrencyExchange
            examples:
              - payin
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                anyOf:
                  - type: object
                    properties:
                      exchangeRateToken:
                        type: string
                        description: 用于在付款请求中跟踪并保证外汇汇率的令牌。
                      transactionType:
                        type: string
                        enum:
                          - PayIn
                          - PayOut
                        description: 交易类型。
                      accountNumber:
                        type: string
                        description: Localpayment账号。
                      sourceCurrency:
                        type: string
                        enum:
                          - ARS
                          - BOB
                          - BRL
                          - CLP
                          - COP
                          - CRC
                          - DOP
                          - USD
                          - GTQ
                          - MXN
                          - PYG
                          - PEN
                          - UYU
                          - USDC
                          - USDT
                        description: '[源货币](/zh/reference/currency-codes)。'
                      creationDate:
                        type: string
                        description: 创建日期。
                      expirationDate:
                        type: string
                        description: 截止日期。
                      quotes:
                        type: array
                        description: 报价信息。
                        items:
                          type: object
                          properties:
                            paymentMethodCode:
                              type: string
                              description: >-
                                [支付方式代码](/zh/reference/get-available-payment-methods)。
                            rate:
                              type: number
                              description: 报价汇率。
                            quoteCurrency:
                              type: string
                              enum:
                                - ARS
                                - BOB
                                - BRL
                                - CLP
                                - COP
                                - CRC
                                - DOP
                                - USD
                                - GTQ
                                - MXN
                                - PYG
                                - PEN
                                - UYU
                                - USDC
                                - USDT
                              description: 报价[货币](/zh/reference/currency-codes)。
                    required:
                      - exchangeRateToken
                      - transactionType
                      - accountNumber
                      - sourceCurrency
                      - creationDate
                      - expirationDate
                      - quotes
                  - type: object
                    properties:
                      Status:
                        type: integer
                        description: 错误代码。
                      Message:
                        type: string
                        description: 其他错误信息。
                      TraceId:
                        type: string
                        description: 错误跟踪 ID。
                    required:
                      - Status
                      - Message
                      - TraceId
                x-examples:
                  Example 1:
                    exchangeRateToken: 978898c8-9162-4af0-a833-07959fe50d44
                    transactionType: PayIn
                    accountNumber: '{{sourceAccountNumber}}'
                    sourceCurrency: ARS
                    creationDate: '2024-12-27T21:20:39.4379138+00:00'
                    expirationDate: '2024-12-28T05:20:39.4379138+00:00'
                    quotes:
                      - paymentMethodCode: '1005'
                        rate: 0.0008369108482392735
                        quoteCurrency: USD
                      - paymentMethodCode: '1023'
                        rate: 0.0008369108482392735
                        quoteCurrency: USD
                      - paymentMethodCode: '1000'
                        rate: 0.0008369108482392735
                        quoteCurrency: USD
                      - paymentMethodCode: '1004'
                        rate: 0.0008369108482392735
                        quoteCurrency: USD
                      - paymentMethodCode: '1002'
                        rate: 0.0008369108482392735
                        quoteCurrency: USD
                  Stablecoin (USDT):
                    accountNumber: '{{sourceAccountNumber}}'
                    creationDate: '2026-01-15T21:03:06.2722727Z'
                    exchangeRateToken: b4eb8276-8edc-43e6-937d-97ecd98ea902
                    expirationDate: '2026-01-15T21:14:06.2722727Z'
                    quotes:
                      - paymentMethodCode: null
                        quoteAccountNumber: '{{quoteAccountNumber}}'
                        quoteCurrency: USD
                        rate: 1
                    sourceCurrency: USDT
                    transactionType: CurrencyExchange
              examples:
                200 - Currency Exchange Quote.:
                  value:
                    exchangeRateToken: 5c3q89a7-f1bc-4ba5-a3b5-411ba0d144ca
                    transactionType: PayIn
                    accountNumber: '{{sourceAccountNumber}}'
                    sourceCurrency: ARS
                    creationDate: '2024-12-27T21:33:32.6513692+00:00'
                    expirationDate: '2024-12-28T05:33:32.6513692+00:00'
                    quotes:
                      - paymentMethodCode: '1005'
                        rate: 0.0008369108482392735
                        quoteCurrency: USD
                      - paymentMethodCode: '1023'
                        rate: 0.0008369108482392735
                        quoteCurrency: USD
                      - paymentMethodCode: '1000'
                        rate: 0.0008369108482392735
                        quoteCurrency: USD
                      - paymentMethodCode: '1004'
                        rate: 0.0008369108482392735
                        quoteCurrency: USD
                      - paymentMethodCode: '1002'
                        rate: 0.0008369108482392735
                        quoteCurrency: USD
                404 - currency error.:
                  value:
                    Status: 404
                    Message: >-
                      Source currency is neither the local nor the account
                      currency for this
                    TraceId: 2a8f37c4-9f60-4436-bd16-d00c9d4ebe00
                403 - Source and quote currencies must be different.:
                  value:
                    Status: 403
                    Message: Source and quote currencies must be different
                    TraceId: 4a1fca4f-a57a-4503-a3c4-71cc5ce7af55
                404 - The quote currency does not exist:
                  value:
                    Status: 404
                    Message: The quote currency does not exist
                    TraceId: 46c82280-9a22-49cf5-bc7-e6da676e0594
                404 -The source currency does not exist.:
                  value:
                    Status: 404
                    Message: The source currency does not exist
                    TraceId: 90f599a3-c0ac-46aa-b4ee-edacb538d80b
                404 - This account doesn't have a PayOut configuration for this.:
                  value:
                    Status: 404
                    Message: This account doesn't have a PayOut configuration for this
                    TraceId: 080d56d1-496b-4661-87ac-75175ef55b31
                200 - FX Quote Stablecoin (USDT).:
                  value:
                    accountNumber: '{{sourceAccountNumber}}'
                    creationDate: '2026-01-15T21:03:06.2722727Z'
                    exchangeRateToken: b4eb8276-8edc-43e6-937d-97ecd98ea902
                    expirationDate: '2026-01-15T21:14:06.2722727Z'
                    quotes:
                      - paymentMethodCode: null
                        quoteAccountNumber: '{{quoteAccountNumber}}'
                        quoteCurrency: USD
                        rate: 1
                    sourceCurrency: USDT
                    transactionType: CurrencyExchange
        '401':
          description: 未经授权。
          content:
            application/json:
              schema:
                type: object
                properties:
                  detail:
                    type: string
                    description: 回复的补充信息。
                  code:
                    type: string
                    description: 状态码。
                  messages:
                    type: array
                    description: 消息列表。
                    items:
                      type: object
                      properties:
                        token_class:
                          type: string
                          description: Token 类。
                        token_type:
                          type: string
                          description: 令牌类型。
                        message:
                          type: string
                          description: 包含补充信息的消息。
                x-examples:
                  Example 1:
                    detail: Given token not valid for any token type
                    code: token_not_valid
                    messages:
                      - token_class: AccessToken
                        token_type: access
                        message: Token is invalid or expired
              examples:
                401 - Token is invalid or expired:
                  value:
                    detail: Given token not valid for any token type
                    code: token_not_valid
                    messages:
                      - token_class: AccessToken
                        token_type: access
                        message: Token is invalid or expired
        '403':
          description: 禁止
          content:
            application/json:
              schema:
                type: object
                properties:
                  detail:
                    type: string
                    description: |
                      回复的补充信息。
                required:
                  - detail
                x-examples:
                  Example 1:
                    detail: You do not have permission to perform this action.
              examples:
                403 - You do not have permission to perform this action.:
                  value:
                    detail: You do not have permission to perform this action.
      security:
        - token: []
      servers:
        - url: https://api.stage.localpayment.com
          description: Stage
components:
  securitySchemes:
    token:
      type: http
      scheme: bearer

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.