wallet icon indicating copy to clipboard operation
wallet copied to clipboard

Pay for invoice - Failed to verify payment protocol signatures

Open bogdanN opened this issue 8 years ago • 16 comments

I've tried to test making payment via "invoice" ability:

  1. Create and redirect user to invoice page: 2017-12-26 18-19-38
  2. Copy bitcoin address and paste it into the wallet app and get an error: 2017-12-26 18-21-58 Also I can see the same error in the log of wallet app: 2017-12-26 18-24-43 Could anyone help me? What is wrong in the address of payment?

bogdanN avatar Dec 26 '17 16:12 bogdanN

It 's not an address issue, it fails for verify paypro because you are using testnet (test.bitpay.com)

cmgustavo avatar Dec 26 '17 16:12 cmgustavo

It has worked ok on Friday morning.

bogdanN avatar Dec 26 '17 16:12 bogdanN

Because on Friday it has been implemented as Non-backwards-compatible BIP72 payment protocol:

Right now (non-backwards-compatible): bitcoin:?r=xxx Before (backwards-compatible): bitcoin:<address>?amount=<amount>&r=xxx

cmgustavo avatar Dec 26 '17 17:12 cmgustavo

@cmgustavo Hi, do you know when it will be fixed ?

painchaudAlexandre avatar Dec 26 '17 17:12 painchaudAlexandre

@cmgustavo, Thank you a lot for clarification. As I understand we should wait until the BitPay client will be updated? Or we can use "backwards-compatible" links to process payments?

bogdanN avatar Dec 26 '17 20:12 bogdanN

i'm the same error also. when it will be fixed ?

sko22 avatar Jan 03 '18 16:01 sko22

I will be honest with y'all, I don't know shit about a computer. I'm 44 yrs old and in the past two years have I layed hands on one

Keensyst avatar Jan 03 '18 16:01 Keensyst

Does BitPay Testnet wallet support Bitcoin Payment Protocol?

lahiruyapa avatar Jan 05 '18 04:01 lahiruyapa

It did until 12/29/2017. After that it no longer worked.

szuranski avatar Jan 05 '18 05:01 szuranski

Any clue if it will be updated ?

Ersian-zz avatar Jan 08 '18 09:01 Ersian-zz

It was fixed a week ago

prascho avatar Jan 17 '18 21:01 prascho

I can confirm this is working. I can pay an invoice created using Testnet and the payment gets confirmed.

I am not receiving the IPN now though like I was before the issue started happening.

szuranski avatar Jan 18 '18 16:01 szuranski

The IPN stopped working about two days ago - I tested on 15th and it was ok. I am no receiving them at the moment - waiting for recovery.

prascho avatar Jan 18 '18 18:01 prascho

The IPN is back online. There is a new issue with test.bitpay.com from the last hour:

There is an issue between Cloudflare's cache and your origin web server. Cloudflare monitors for these errors and automatically investigates the cause. To help support the investigation, you can pull the corresponding error log from your web server and submit it our support team. Please include the Ray ID (which is at the bottom of this error page). Additional troubleshooting resources.

prascho avatar Jan 22 '18 23:01 prascho

I installed CoPay/BitPay on my PC. I'm testing a payment system based on BIP70. I created a link like that "<a href="bitcoin:?r=http://localhost:37391/">Pay</a>" . When I click on the link, the wallet launched then send a http request to my server at http://localhost:37391/. The server returns a PaymentRequest. Like this (I'm using NBitcoin):

public class PaymentServer : IDisposable
    {
        HttpListener _Listener;
        Random rand = new Random();
        string _Prefix;
        public PaymentServer()
        {
            while (true)
            {
                try
                {
                    _Prefix = "http://localhost:37391" /*+ rand.Next(2000, 50000)*/ + "/";
                    _Listener = new HttpListener();
                    _Listener.Prefixes.Add(_Prefix);
                    _Listener.Start();
                    _Listener.BeginGetContext(ListenerCallback, null);
                    break;
                }
                catch (HttpListenerException)
                {
                }
            }
        }

        void ListenerCallback(IAsyncResult ar)
        {
            try
            {
                var context = _Listener.EndGetContext(ar);
                //var type = context.Request.QueryString.Get("type");
                var businessId = 0;// int.Parse(context.Request.QueryString.Get("id"));
                var now = DateTimeOffset.UtcNow;
                var expire = now + TimeSpan.FromDays(1);
                TxOut txOut = new TxOut(Money.Satoshis(1), new Key().ScriptPubKey);
                context.Response.ContentType = PaymentRequest.MediaType;
                PaymentRequest request = new PaymentRequest();
                //request.Details.MerchantData = BitConverter.GetBytes(businessId);
                request.Details.Network = Network.TestNet;
                request.Details.Expires = expire;
                request.Details.Time = now;
                request.Details.PaymentUrl = new Uri(_Prefix + "?id=" + businessId + "&type=Payment");
                request.Details.Outputs.Add(new PaymentOutput(txOut));
                //request.PKIType = PKIType.None;
                //request.Sign(File.ReadAllBytes("data/NicolasDorierMerchant.pfx"), PKIType.X509SHA256);
                request.WriteTo(context.Response.OutputStream);
                context.Response.Close();
                _Listener.BeginGetContext(ListenerCallback, null);
            }
            catch (Exception)
            {
                if (!_Stopped)
                    throw;
            }
        }

But CoPay reported error: "Payment Protocol Invalid". I don't know which was wrong here. This is my side or CoPay. Can/how I investigate CoPay log or source to find the root cause and solution? Thank you very much!

mrviit avatar Jan 24 '18 10:01 mrviit

This is because of this code src/js/services/payproService.js:

else if (!paypro.verified) {
   $log.warn('Failed to verify payment protocol signatures');
   return cb(gettextCatalog.getString('Payment Protocol Invalid'));
}

It seems that I have signed the message with wrong PKI key. How can I get a valid key then sign the transaction correctly?

mrviit avatar Jan 24 '18 10:01 mrviit