View Source ExXendit.ForeignExchange (ExXendit v0.1.10)

Handles functions at https://docs.xendit.co/apidocs/foreign-exchange-introduction

A created quote returns a conversion rate that is active for a short period (~30s, see the expires field). A created conversion acts on an active quote to convert one currency into another.

All endpoints require the api-version: 2025-06-06 header; these functions set it automatically (override via the :api_version header option).

Summary

Functions

Creates a conversion acting on an active quote.

Fetches a conversion by its conversion_id.

Fetches a quote by its quote_id.

Functions

create_conversion(params, headers \\ %{})

@spec create_conversion(map(), ExXendit.headers()) :: {:ok, Req.Response.t()}

Creates a conversion acting on an active quote.

Body Parameters

  • :quote_id* - Quote ID (qo-<uuid>) from create_quote/2.

  • :reference_id* - A client-defined identifier for the conversion.

Response

Includes conversion_id (cnv-<uuid>) and status (PENDING | SUCCEEDED | FAILED).

create_quote(params, headers \\ %{})

@spec create_quote(map(), ExXendit.headers()) :: {:ok, Req.Response.t()}

Creates an FX quote.

Body Parameters

  • :reference_id* - A client-defined identifier for the quote.

  • :type* - "CONVERSION" or "PAYOUT".

  • :source_currency* - One of USD, SGD, IDR, PHP, MYR, THB, HKD.

  • :destination_currency* - One of USD, SGD, IDR, PHP, MYR, THB, VND, HKD, CNY, KRW, AUD, EUR.

  • :source_amount / :destination_amount - Exactly one of the two, in minor units. Quotes must be at least US$1.00 equivalent.

Response

Includes quote_id (qo-<uuid>), fx_rate, and expires.

get_conversion(conversion_id, headers \\ %{})

@spec get_conversion(String.t(), ExXendit.headers()) :: {:ok, Req.Response.t()}

Fetches a conversion by its conversion_id.

get_quote(quote_id, headers \\ %{})

@spec get_quote(String.t(), ExXendit.headers()) :: {:ok, Req.Response.t()}

Fetches a quote by its quote_id.