Bitcoin Forum

Bitcoin => Wallet software => Topic started by: Nicolas Dorier on May 31, 2014, 03:33:01 PM



Title: NBitcoin : Payment Protocol Implementation
Post by: Nicolas Dorier on May 31, 2014, 03:33:01 PM
Hello all,
I'm happy to announce the release of NBitcoin v1.0.4.1, which include the payment protocol (BIP 70, 21, 72).
How to use can be found in the tests here : https://github.com/NicolasDorier/NBitcoin/blob/master/NBitcoin.Tests/PaymentTests.cs

Example
Quote
public void CanTalkToPaymentServer()
{
   using(var server = new PaymentServerTester())
   {
      var uri = server.GetPaymentRequestUri(2);
      BitcoinUrlBuilder btcUri = new BitcoinUrlBuilder(uri);
      var request = btcUri.GetPaymentRequest();
      Assert.True(request.VerifySignature());
      Assert.Equal(2, BitConverter.ToInt32(request.Details.MerchantData, 0));
      var ack = request.CreatePayment().SubmitPayment();
      Assert.NotNull(ack);
   }
}

Have fun ! ;)

Github : https://github.com/NicolasDorier/NBitcoin
Nuget : https://www.nuget.org/packages/NBitcoin/