Dave Dave - 1 month ago 12
ASP.NET (C#) Question

How to use Coinpayments.net nuget package with ASP.NET MVC?

I am working on ASP.NET MVC website where users pays some amount of bitcoins and after payment he can download specific digital art file. Instant payment and download.

I have found nuget package Coinpayments.NET.

https://www.nuget.org/packages/Coinpayments.NET/

I can't find any example how to use this nuget package with ASP.NET MVC.

Reading documentation on official website which is for PHP doesn't help.

Please help me and if You can provide some example how to make transaction and after successfull payment redirect user to specified action.

Edit:
I have sample source code:

using System;

namespace CoinpaymentsTest
{
class Program
{
static void Main(string[] args)
{
var cp = new Coinpayments.Coinpayments("PRIVATEKEY", "PUBLICKEY");

var payment = cp.CreateTransactionSimple(2, "USD", "BTC", "ADDRESS", "IPN");
Console.WriteLine(payment.error);

Console.WriteLine(payment.result.qrcode_url);

var check = cp.GetTransactionInfo(payment.result.txn_id);

Console.WriteLine(check.result.payment_address);

Console.Read();
}
}
}


But the question is how to get information that user has successfully paid?

I need explanation on this source code.

Answer

Like you said, there is little information on the Internet about this library. On Nuget there is no information or documentation available about how to use it, but we have information about the owner of the project, Lode Kennes and his nickname linh721990. So the following google search linh721990 github provide no result or clues, but linh721990 bitbucket provides a link for the source code on the library, together with a little test application:

https://bitbucket.org/linh721990/coinpayments.net-c

If you take a look at the file on https://bitbucket.org/linh721990/coinpayments.net-c/src/316088af0432ec3409d70c13f7fe510d27b47445/CoinpaymentsTest/Program.cs?at=master&fileviewer=file-view-default you can check some basic functionality:

using System;

namespace CoinpaymentsTest
{
  class Program
  {
    static void Main(string[] args)
    {
        var cp = new Coinpayments.Coinpayments("PRIVATEKEY", "PUBLICKEY");

        var payment = cp.CreateTransactionSimple(2, "USD", "BTC");
        Console.WriteLine(payment.error);

        Console.WriteLine(payment.result.qrcode_url);

        var check = cp.GetTransactionInfo(payment.result.txn_id);

        Console.WriteLine(check.result.payment_address);

        Console.Read();
    }
  }
}

But the relevant code about the functionality of the Nuget package is in the file https://bitbucket.org/linh721990/coinpayments.net-c/src/316088af0432ec3409d70c13f7fe510d27b47445/Coinpayments/Coinpayments.cs?at=master&fileviewer=file-view-default explained in 145 lines.