Author

Topic: NBitcoin : Payment Protocol Implementation (Read 666 times)

hero member
Activity: 714
Merit: 662
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 ! Wink

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