Create an FX settlementSignature required
The Partner can use this API to create a settlement.
The createExchange API supports the following currency settlement scenarios:
- Create a settlement with forward rates:
- For this scenario, the process is asynchronous. WorldFirst responds to the Partner that the settlement is being processed, rather than the final result of the settlement. To query the forward deal result, a Partner can utilize the inquiryExchange interface. WorldFirst sends the notification about the settlement result with the notifyExchange interface.
- Create a settlement with spot rates
- For this scenario, the process is synchronous. WorldFirst returns the result of the settlement in the response message.
Structure
A message consists of a header and body. The following sections are focused on the body structure. For the header structure, see:
Request parameters
customerId String CONDITIONAL
The unique id that is assigned by WorldFirst to identify an account on WorldFirst.
customerId and accessToken cannot be both empty.
More information:
- Maximum length: 64 characters
accessToken String CONDITIONAL
The access token that is used for OAuth authorization.
customerId and accessToken cannot be both empty.
More information:
- Maximum length: 64 characters
exchangeRequestId String REQUIRED
The unique ID that is assigned by the Partner to identify a settlement request.
More information:
- This field is an API idempotency field.For details about API idempotency, see the Idempotency chapter.
- Maximum length: 128 characters
quote Quote CONDITIONAL
The quote information.
This parameter is required when exchangeMode is
APPOINTED
and the value of this parameter must be consistent with the quote parameter in the response message of createQuote API.
sell QuoteAmount REQUIRED
The amount and the currency to be sold.
buy QuoteAmount REQUIRED
The amount and the currency to be bought.
exchangeMode String REQUIRED
Defines the mode of the settlement request, which could be either in real-time, or at an appointed time.
Valid values are:
REALTIME
: indicates an exchange rate at the real-time.APPOINTED
: indicates an exchange rate at the appointed time.
exchangeTradeType String REQUIRED
Defines the type that the settlement trades in.
Valid values are:
SPOT
: Using spot rate.FORWARD
: Using forward rate.UNFUNDED_SPOT
: Using unfunded spot rate.
exchangeUnfundedInfo ExchangeForwardInfo CONDITIONAL
Information about the forward exchange.
This field is required when exchangeTradeType is
UNFUNDED_SPOT
.
exchangeForwardInfo ExchangeForwardInfo CONDITIONAL
Information about the forward exchange.
This field is required when exchangeTradeType is
FORWARD
.
exchangeOrderAddition ExchangeQuoteAddition
Additional information that is attached to the settlement request, such as the ID of the reference order.
exchangeRequestTime String
The time of the settlement request.
More information:
- The value follows the ISO 8601 standard format. For example, "2019-11-27T12:01:01+08:00".
Response parameters
result Result REQUIRED
Indicates whether this API is called successfully.
exchangeId String REQUIRED
The unique ID that is assigned by WorldFirst to identify a settlement request.
This field is returned only when the value of result.resultStatus is
S
.
More information:
- Maximum length: 64 characters
exchangeRequestId String REQUIRED
The unique ID that is assigned by the Partner to identify a settlement request.
This field is returned only when the value of result.resultStatus is
S
.
More information:
- This field is an API idempotency field.For details about API idempotency, see the Idempotency chapter.
- Maximum length: 128 characters
sell QuoteAmount REQUIRED
The amount and the currency to be sold.
This field is returned only when the value of result.resultStatus is
S
.
buy QuoteAmount REQUIRED
The amount and the currency to be bought.
This field is returned only when the value of result.resultStatus is
S
.
exchangeCreateTime DateTime REQUIRED
The time that the settlement request is created.
This field is returned only when the value of result.resultStatus is
S
.
More information:
- The value follows the ISO 8601 standard format. For example, "2019-11-27T12:01:01+08:00".
exchangeFinishTime DateTime
The time that the settlement request is completed.
This field is returned only when the value of result.resultStatus is
S
.
More information:
- The value follows the ISO 8601 standard format. For example, "2019-11-27T12:01:01+08:00".
quote Quote REQUIRED
Transfer quote information.
This field is returned only when the value of result.resultStatus is
S
.
exchangeMode String REQUIRED
Defines the mode of the settlement request, which could be either in real-time, or at an appointed time.
Valid values are:
REALTIME
: indicates an exchange rate at the real-time.APPOINTED
: indicates an exchange rate at the appointed time.
This field is returned only when the value of result.resultStatus is
S
.
exchangeTradeType String REQUIRED
Defines the type that the settlement trades in.
Valid values are:
SPOT
: Using spot rate.FORWARD
: Using forward rate.UNFUNDED_SPOT
: Using unfunded spot rate.
This field is returned only when the value of result.resultStatus is
S
.
exchangeUnfundedInfo ExchangeForwardInfo CONDITIONAL
Information about the forward exchange.
This field is returned only when the value of result.resultStatus is
S
and the value of exchangeTradeType isUNFUNDED_SPOT
.
exchangeForwardInfo ExchangeForwardInfo CONDITIONAL
Information about the forward exchange.
This field is returned only when the value of result.resultStatus is
S
and the value of exchangeTradeType isFORWARD
.
Request
Response
Result processing logic
After calling the API, a response is returned. The possible responses for result.resultStatus
are:
Result status | Description |
S | This indicates the API call succeeded. For the settlements with forward rates:
For the settlements with on-spot rates:
|
F | This indicates the API call failed. For more information on why the call failed, see |
U | This indicates the API call result is unknown. Call the inquiryExchange API to check the exchange status. |
System-realted result codes
Code | Value | Message | Further action |
---|---|---|---|
SUCCESS | S | Success | The spot settlement has been completed successfully. |
PROCESSING | S | The settlement is being processed. | This result code is for the forward settlement only. Call the inquiryExchange API for the settlement result or wait for notifications. |
PARAM_ILLEGAL | F | Illegal parameters exist. For example, a non-numeric input, or an invalid date. | Check and verify whether the request fields, including the header fields and body fields, are correct and valid. For details on the fields of each API, see the specific API Structure section. |
PROCESS_FAIL | F | A general business failure occurred. Do not retry. | Human intervention is usually needed. It is recommended that you contact our Technical Support Team to resolve the issue. |
UNKNOWN_EXCEPTION | U | API failed due to unknown reason. | The service might be down, retry later. If the issue persists, contact our Technical Support Team. |
REQUEST_TRAFFIC_EXCEED_LIMIT | U | The request traffic exceeds the limit. | Call the interface again to resolve the issue. If the issue persists, contact our Technical Support Team. |
INVALID_API | F | The called API is invalid or not active. | Check whether the correct API is being called. |
INVALID_CLIENT | F | The client is invalid. | The Client ID does not exist or is invalid. |
INVALID_SIGNATURE | F | The signature is invalid. | Make sure the request is properly signed with a valid signature. |
METHOD_NOT_SUPPORTED | F | The server does not implement the requested HTTP method. | Ensure the HTTP method is |
Business-related result codes
Code | Value | Message | Further action |
---|---|---|---|
BALANCE_INSUFFICIENT | F | The balance is insufficient for the exchange. | This result code is for settlements with on-spot rates only. Make sure the balance is sufficient and try again. |
AUTHORIZATION_NOT_EXIST | F | The authorization does not exist. | Make sure that the input is correct. If the issue persists, contact our Technical Support Team to verify the authorization status. |
UN_SUPPORT_BUSINESS | F | Unsupported business. | Invalid parameters are used e.g. currency is incorrect. Retry with the correct information. |
QUOTE_EXPIRED | F | The quote is expired. | Call the createQuote API to create a new quote. Retry creating a new settlement request with the new quote. |
FX_RELATED_ORDER_NOT_EXIST | F | The exchange order does not exist. | This result code is for forward settlements only. Make sure the |
CURRENCY_NOT_SUPPORT | F | The currency is not supported. | Make sure the currency input is correct and try again. |
CONTRACT_CHECK_FAIL | F | The contract check has failed. | Check the contract status before retrying. |