Server API version 1.0
Java

Results for

icon-search-large No search results yet
Enter your search query above

Convert amount

GET https://{domainname}/v1/{merchantId}/services/convert/amount

Services

Under services you find several calls that can be used to support your payment flow:

  • Test your connection to us
  • Convert an amount from one currency to another
  • Convert between different bank account notations
  • Retrieve the card type and country where the card was issued based on the IIN of the card

Request

Using the convert amount API you can ask us to convert an amount from one currency into another currency. We will use the rate set configured for your account to perform the conversion.

All amount fields in our API are in cents with each amount having 2 decimals, regardless of the actual decimal places the currency has. So JPY has no decimals in it currency, but you will need to add two zeros as cents.

Query parameters

Query parameters for this method

  Property Type Required Repeat Description
source string yes no
Three-letter ISO currency code representing the source currency
target string yes no
Three-letter ISO currency code representing the target currency
amount integer yes no
Amount to be converted in cents and always having 2 decimals

Request example

SDK: Java

This scenario you will probably use the most

  • ConvertAmountParams query = new ConvertAmountParams();
    query.setSource("EUR");
    query.setTarget("USD");
    query.setAmount(100L);
    
    ConvertAmount response = client.merchant("merchantId").services().convertAmount(query);
    

Responses

Please find below an overview of the possible responses.

Response 200 - OKConvertAmount

The response contains the converted amount

   Property Type Required Description
convertedAmount integer no

Converted amount in cents and having 2 decimal

Response example

SDK: Java

This scenario you will probably use the most

  • {
        "convertedAmount" : 138
    }
    

Response 400 - Bad requestErrorResponse

     Property Type Required Description
errorId string yes

Unique reference, for debugging purposes, of this error response

array yes
List of one or more errors
object no SDK object type: APIError
category string no

Category the error belongs to. The category should give an indication of the type of error you are dealing with. Possible values:
  • CONNECT_PLATFORM_ERROR - indicating that a functional error has occurred in the Connect platform.
  • PAYMENT_PLATFORM_ERROR - indicating that a functional error has occurred in the Payment platform.
  • IO_ERROR - indicating that a technical error has occurred within the Connect platform or between Connect and any of the payment platforms or third party systems.

code string yes

Error code

httpStatusCode integer no

HTTP status code for this error that can be used to determine the type of error

id string no

ID of the error. This is a short human-readable message that briefly describes the error.

message string no

Human-readable error message that is not meant to be relayed to consumer as it might tip off people who are trying to commit fraud

propertyName string no

Returned only if the error relates to a value that was missing or incorrect.
Contains a location path to the value as a JSonata query.
Some common examples:
  • a.b selects the value of property b of root property a,
  • a[1] selects the first element of the array in root property a,
  • a[b='some value'] selects all elements of the array in root property a that have a property b with value 'some value'.

requestId string no

ID of the request that can be used for debugging purposes

Response example

SDK: Java

This scenario you will probably use the most

  • {
        "errorId" : "15eabcd5-30b3-479b-ae03-67bb351c07e6-00000092",
        "errors" : [
            {
                "code" : "20000000",
                "propertyName" : "bankAccountBban.accountNumber",
                "message" : "PARAMETER_NOT_FOUND_IN_REQUEST"
            }
        ]
    }
    
icon_top_1