public BitpayRateProvider(Bitpay bitpay) { if (bitpay == null) { throw new ArgumentNullException(nameof(bitpay)); } _Bitpay = bitpay; }
public void BitpayCheckout() { var key = new Key(Encoders.Hex.DecodeData("7b70a06f35562873e3dcb46005ed0fe78e1991ad906e56adaaafa40ba861e056")); var url = new Uri("https://test.bitpay.com/"); var btcpay = new Bitpay(key, url); var invoice = btcpay.CreateInvoice(new Invoice() { Price = 5.0, Currency = "USD", PosData = "posData", OrderId = "cdfd8a5f-6928-4c3b-ba9b-ddf438029e73", ItemDesc = "Hello from the otherside" }, Facade.Merchant); // go to invoice.Url Console.WriteLine(invoice.Url); }
private void EnsureRegisteredKey() { if (!Directory.Exists(Network.Name)) { Directory.CreateDirectory(Network.Name); } BitcoinSecret k = null; var keyFile = Path.Combine(Network.Name, "key.env"); try { k = new BitcoinSecret(File.ReadAllText(keyFile), Network); } catch { } if (k != null) { try { Bitpay = new Bitpay(k.PrivateKey, BitPayUri); if (Bitpay.TestAccess(Facade.Merchant)) { return; } } catch { } } k = k ?? new BitcoinSecret(new Key(), Network); File.WriteAllText(keyFile, k.ToString()); Bitpay = new Bitpay(k.PrivateKey, BitPayUri); var pairing = Bitpay.RequestClientAuthorization("test", Facade.Merchant); throw new AssertException("You need to approve the test key to access bitpay by going to this link " + pairing.CreateLink(Bitpay.BaseUrl).AbsoluteUri); }
public TestAccount(ServerTester parent) { this.parent = parent; BitPay = new Bitpay(new Key(), parent.PayTester.ServerUri); }