Before Create Convert, you need to create a convert request.

Endpoints

POST /api/Payment/ConvertRequest

Request

URI Parameters

NameTypeAdditional information
buyAmountdecimal numberThe amount you want to buy
sellAmountdecimal numberThe amount you want to sell
fromCurrencystringType of currency that will be charged from your wallet
toCurrencystringType of currency you want to buy

Response

NameTypeAdditional information
StatusstringShow status of request
RequestIdglobally unique identifierNone.
BuyAmountdecimal numberBuy amount
ChargeAmountdecimal numberCharge amount
ErrorsString arrayAll 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 NumberDescription
601Not Supporting to this Currency
602Balance Not Exist
603Amount must be bigger than 0
604Amount must be bigger than 10$
605Missing Funds
606Please Select Buy Or Sell Amount
607Profile Not Exist
500Server error
401Unauthorized (need to login)
400Bad inputs
404Url Request Not Found