Skip to content

Convert balances

Request

Converts balance from one currency to another. In the API you can either send target_amount or source_amount and the API will calculate the other amount for you.

Security
JWT
Bodyapplication/jsonrequired
One of:
source_currencystring, (iso-4217)required

The currency code in ISO 4217 format. Supported currencies: USD, EUR, GBP, AED, SGD and AUD. source_currency and target_currency must differ, or the request returns 400.

Example:"USD"
target_currencystring, (iso-4217)required

The currency code in ISO 4217 format. Supported currencies: USD, EUR, GBP, AED, SGD and AUD. source_currency and target_currency must differ, or the request returns 400.

Example:"EUR"
source_amountnumber, >= 1required

The amount you want to convert. A positive integer representing the smallest currency unit. For example, if the amount is $299.00, then pass 29900 in this field. In the case of three decimal currencies, such as KWD, BHD and OMR, to represent an amount of 295.991, pass the value as 295990. And in the case of zero decimal currencies such as JPY, for amount ¥295, pass the value as 295. Only one of `source_amount` or `target_amount` can be sent.

Example:1000
curl -i -X POST \
  https://api.glomopay.com/api/v1/balance_conversions \
  -H 'Authorization: Bearer <YOUR_JWT_HERE>' \
  -H 'Content-Type: application/json' \
  -d '{
    "source_currency": "USD",
    "target_currency": "EUR",
    "source_amount": 10000
  }'

Responses

Balance conversion created successfully

Bodyapplication/json
idstringread-only

The unique identifier for the balance balance.

Example:"conv_6776d57dnbTWj"
fromobject(Money)

the amount and currency of the balance used for conversion

toobject(Money)

the amount and currency of the balance after conversion

feesobject(Money)

Total fees for the conversion

mid_market_rateobject(ConversionRate)

The mid-market rate at the time of conversion

statusstringread-only

The status of the balance conversion.

  • pending — the conversion has been created and has not completed yet.
  • success — the converted amount has been credited. Terminal.
  • failed — the conversion did not complete. Terminal.
Enum:"pending""success""failed"
Example:"success"
created_atstring, (date-time)read-only

When the balance conversion was created, as an ISO 8601 date-time in UTC.

Example:"2021-01-01T00:00:00Z"
Response
{ "id": "conv_6776d57dnbTWj", "from": { "amount": 1000, "currency": "USD" }, "to": { "amount": 1000, "currency": "USD" }, "fees": { "amount": 1000, "currency": "USD" }, "mid_market_rate": { "currency": "USD", "rate": 1.4 }, "status": "success", "created_at": "2021-01-01T00:00:00Z" }