Before Create Convert, you need to create a convert request.
Endpoints
POST /api/Payment/ConvertRequest
Request
URI Parameters
Name | Type | Additional information |
---|---|---|
buyAmount | decimal number | The amount you want to buy |
sellAmount | decimal number | The amount you want to sell |
fromCurrency | string | Type of currency that will be charged from your wallet |
toCurrency | string | Type of currency you want to buy |
Response
Name | Type | Additional information |
---|---|---|
Status | string | Show status of request |
RequestId | globally unique identifier | None. |
BuyAmount | decimal number | Buy amount |
ChargeAmount | decimal number | Charge amount |
Errors | String array | All the necessary files that you need to upload |
Example Request
public async Task<object> ConvertRequest(string access_token, decimal BuyAmount, string fromCurrency, string toCurrency)
{
using (var client = new HttpClient())
{
try
{
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;
client.DefaultRequestHeaders.Authorization =
new AuthenticationHeaderValue("Bearer", access_token);
var queryParameters = new Dictionary<string, string>
{
{ "BuyAmount", BuyAmount.ToString() },
{ "fromCurrency", fromCurrency },
{ "toCurrency", toCurrency },
};
var dictFormUrlEncoded = new FormUrlEncodedContent(queryParameters);
var queryString = await dictFormUrlEncoded.ReadAsStringAsync();
var url = root + "/api/Payment/ConvertRequest";
var response = client.PostAsync(url + $"?{queryString}", null).Result;
if (response.IsSuccessStatusCode)
{
string result = await response.Content.ReadAsStringAsync();
JObject jObject = JObject.Parse(result);
return jObject;
}
else return response.StatusCode;
}
catch (Exception e)
{
return "Exception: " + e.Message;
}
}
}
Example Response
{
"Status": "Create Request Successfully",
"convertRequest": {
"RequestId": "6287135b-ba0b-4c1d-8471-abd32433b6e0",
"BuyAmount": "100.00 EUR",
"ChargeAmount": "344.12 ILS",
"FinalQuote": "3.44124"
},
"Errors": null
}
Errors Index
Error Number | Description |
---|---|
601 | Not Supporting to this Currency |
602 | Balance Not Exist |
603 | Amount must be bigger than 0 |
604 | Amount must be bigger than 10$ |
605 | Missing Funds |
606 | Please Select Buy Or Sell Amount |
607 | Profile Not Exist |
500 | Server error |
401 | Unauthorized (need to login) |
400 | Bad inputs |
404 | Url Request Not Found |