every one I need to integrate Cryptography currency in our project.And I have to choose CoinGate APIS for Cryptography currency. I am new for this Cryptography payment integration so any know how can do with the asp.net with MVC c#. I have created one demo for the payment integration and I go for the create order but that time I am getting an error Unauthorized. And In this demo I have not idea how can set callback_url for the payment etc.. Anyone know how can do that then please let me know. Here below I have listed my code. I have to go with this URL:
https://github.com/cizu64/Coingate.net
This is my controller Index method for the go create order:
public async Task<ActionResult> Index()
{
var cg = new Coingate.Net.Coingate(apikey, apiSecret,appId);
var orders = await cg.CreateOrder(new Order
{
Price = 100,
Currency = "USD",
ReceiveCurrency = "BTC"
});
return View();
}
public async Task<dynamic> CreateOrder(Order dto, string resourcePath = "/v1/orders/")
{
_client.BaseAddress = new Uri(_baseUri);
ConfigureHeaders(Signature());
var body = new FormUrlEncodedContent(new[]
{
new KeyValuePair<string, string>("order_id", dto.OrderId.ToString()),
new KeyValuePair<string, string>("price", dto.Price.ToString()),
new KeyValuePair<string, string>("currency", dto.Currency),
new KeyValuePair<string, string>("receive_currency", dto.ReceiveCurrency),
new KeyValuePair<string, string>("title", dto.Title),
new KeyValuePair<string, string>("description", dto.Description),
new KeyValuePair<string, string>("callback_url", dto.CallbackUrl),
new KeyValuePair<string, string>("cancel_url", dto.CancelUrl),
new KeyValuePair<string, string>("success_url", dto.SuccessUrl)
});
var response = await _client.PostAsync(resourcePath, body);
if (!response.IsSuccessStatusCode) return HttpStatusCode.BadRequest;
var order = await response.Content.ReadAsAsync<dynamic>();
return order;
}
This is my order class:
public int OrderId { get; set; }
public double Price { get; set; }
public string Currency { get; set; }
public string ReceiveCurrency { get; set; }
public string Title { get; set; }
public string Description { get; set; }
public string CallbackUrl { get; set; }
public string CancelUrl { get; set; }
public string SuccessUrl { get; set; }
Anyone know how can do that then please let me know.