Skip to content
This repository has been archived by the owner on Feb 23, 2022. It is now read-only.

Some invoices return a Unexpected return code: 500 #23

Open
astupidmoose opened this issue Feb 15, 2019 · 74 comments
Open

Some invoices return a Unexpected return code: 500 #23

astupidmoose opened this issue Feb 15, 2019 · 74 comments

Comments

@astupidmoose
Copy link
Contributor

For context: I host BTCPay and Woocommerce on different machines, on different networks.

Sometimes, BTCPay generates an invoice for the customer, however it gets hit with:

Error while sending IPN (1001 invoice_created): Unexpected return code: 500

BTCPay continues to generate this error every 10 minutes until the invoice expires. BTCPay is never able to assign metadata to the woocommerce invoice. Once expired, the status is set to expired and generates another error 500:

Error while sending IPN (1004 invoice_expired): Unexpected return code: 500

This cycles 3 times every 10 minutes for 1 hour.

I know that error 500 indicates a server error, but it seems completely random at the moment and only happens to some invoices.

@astupidmoose
Copy link
Contributor Author

I just checked my woocommerce "fatal-errors.log" file and found the following error on each attempt:

2019-02-14T15:33:49+00:00 CRITICAL Uncaught Exception: Received IPN for order 72724 with BTCPay invoice id72724 while expected BTCPay invoice is in /var/www/html/wp-content/plugins/btcpay-for-woocommerce/class-wc-gateway-btcpay.php:1001
Stack trace:
#0 /var/www/html/wp-includes/class-wp-hook.php(286): WC_Gateway_BtcPay->ipn_callback('')
#1 /var/www/html/wp-includes/class-wp-hook.php(310): WP_Hook->apply_filters('', Array)
#2 /var/www/html/wp-includes/plugin.php(453): WP_Hook->do_action(Array)
#3 /var/www/html/wp-content/plugins/woocommerce/includes/class-wc-api.php(97): do_action('woocommerce_api...')
#4 /var/www/html/wp-includes/class-wp-hook.php(286): WC_API->handle_api_requests(Object(WP))
#5 /var/www/html/wp-includes/class-wp-hook.php(310): WP_Hook->apply_filters(NULL, Array)
#6 /var/www/html/wp-includes/plugin.php(515): WP_Hook->do_action(Array)
#7 /var/www/html/wp-includes/class-wp.php(375): do_action_ref_array('parse_request', Array)
#8 /var/www/html/wp-includes/class-wp.php(715): WP->parse_request('')
#9 /var/www/html/wp-includes/func in /var/www/html/wp-content/plugins/btcpay-for-woocommerce/class-wc-gateway-btcpay.php on line 1001

@NicolasDorier
Copy link
Member

When did it start appearing? which plugin version?

@astupidmoose
Copy link
Contributor Author

I'm currently on Version 3.0.3.

This has been going for a few weeks. I think it might be the same issue as before, which hangfire was getting held up but not that hangfire is no longer existing it simply shows this in the logs.

I will upgrade to 3.0.6 to see if this helps, but I suspect its been like this for a while.

@NicolasDorier
Copy link
Member

@Kukks any memory about this?

@Kukks
Copy link
Member

Kukks commented Feb 18, 2019

No clue what could be wrong here

@pavlenex
Copy link
Contributor

I can confirm that I'm seeing this error sometimes on expired invoices as well. It's been going on for ages, I just have no idea how to troubleshoot it.

2/16/2019 8:14:20 PM | Creation of invoice starting
2/16/2019 8:14:21 PM | BTC_USD: The rating rule is coinaverage(BTC_USD)
2/16/2019 8:14:21 PM | BTC_USD: The evaluated rating rule is 3612.17840304482
2/16/2019 8:14:25 PM | Invoice 3PaGaD72UcSPkBQsPKw984 new event: invoice_created (1001)
2/16/2019 8:14:27 PM | Error while sending IPN (1001 invoice_created): Unexpected return code: 500
2/16/2019 8:24:28 PM | Error while sending IPN (1001 invoice_created): Unexpected return code: 500
2/16/2019 8:34:29 PM | Error while sending IPN (1001 invoice_created): Unexpected return code: 500
2/16/2019 8:44:22 PM | Invoice status is expired
2/16/2019 8:44:22 PM | Invoice 3PaGaD72UcSPkBQsPKw984 new event: invoice_expired (1004)
2/16/2019 8:44:24 PM | Error while sending IPN (1004 invoice_expired): Unexpected return code: 500
2/16/2019 8:44:25 PM | Error while sending IPN (1004 invoice_expired): Unexpected return code: 500
2/16/2019 8:44:30 PM | Error while sending IPN (1001 invoice_created): Unexpected return code: 500
2/16/2019 8:54:25 PM | Error while sending IPN (1004 invoice_expired): Unexpected return code: 500
2/16/2019 8:54:26 PM | Error while sending IPN (1004 invoice_expired): Unexpected return code: 500
2/16/2019 8:54:31 PM | Error while sending IPN (1001 invoice_created): Unexpected return code: 500
2/16/2019 9:04:26 PM | Error while sending IPN (1004 invoice_expired): Unexpected return code: 500
2/16/2019 9:04:27 PM | Error while sending IPN (1004 invoice_expired): Unexpected return code: 500
2/16/2019 9:04:33 PM | Error while sending IPN (1001 invoice_created): Unexpected return code: 500
2/16/2019 9:14:28 PM | Error while sending IPN (1004 invoice_expired): Unexpected return code: 500
2/16/2019 9:14:28 PM | Error while sending IPN (1004 invoice_expired): Unexpected return code: 500
2/16/2019 9:24:29 PM | Error while sending IPN (1004 invoice_expired): Unexpected return code: 500
2/16/2019 9:24:30 PM | Error while sending IPN (1004 invoice_expired): Unexpected return code: 500
2/16/2019 9:34:30 PM | Error while sending IPN (1004 invoice_expired): Unexpected return code: 500
2/16/2019 9:34:31 PM | Error while sending IPN (1004 invoice_expired): Unexpected return code: 500
2/17/2019 4:14:22 AM | Invoice 3PaGaD72UcSPkBQsPKw984 is not monitored anymore.

I'm unable to connect the events happening with any error WooCommerce/WordPress or server side logs.

@Eskyee
Copy link

Eskyee commented Feb 18, 2019

screenshot 2019-02-18 at 08 28 56

I'm running the latest version, 3.0.6, I`m not seeing any problems, with any expired invoices, just so you know!!

@Kukks
Copy link
Member

Kukks commented Feb 18, 2019 via email

@NicolasDorier
Copy link
Member

NicolasDorier commented Feb 18, 2019

@Kukks I think I remember this issue. I think I fixed it in the old version, you may have thrown the fix away when migrated.

Basically it is a race condition if somebody click twice on the checkout button too fast.

@NicolasDorier
Copy link
Member

@astupidmoose can you check that for your order, BTCPay created 2 different BTCPay invoices?

@NicolasDorier
Copy link
Member

@astupidmoose can you also confirm that the customer does not have any issue and you did not had to manually fix anything?

@astupidmoose
Copy link
Contributor Author

@astupidmoose can you check that for your order, BTCPay created 2 different BTCPay invoices?

No, for this example, 72724 is only generated once in BTCPay.

@astupidmoose can you also confirm that the customer does not have any issue and you did not had to manually fix anything?

Customers never pay these invoices when this happens. I am thinking they are presented an Error that BTCPAY is not working and abandon the cart. Unfortunately, this is happening to customers who do not inform us of an issue and simply leave.

@astupidmoose
Copy link
Contributor Author

astupidmoose commented Feb 18, 2019

Customers never pay these invoices when this happens. I am thinking they are presented an Error that BTCPAY is not working and abandon the cart. Unfortunately, this is happening to customers who do not inform us of an issue and simply leave.

OK this could be wrong....

I found an invoice where the error happened on creation, however was paid by the customer and then fixed itself.

On creation, the fatal-errors log shows:

2019-02-15T19:15:00+00:00 CRITICAL Uncaught Exception: Received IPN for order 72954 with BTCPay invoice id72954 while expected BTCPay invoice is in /var/www/html/wp-content/plugins/btcpay-for-woocommerce/class-wc-gateway-btcpay.php:1001
Stack trace:
#0 /var/www/html/wp-includes/class-wp-hook.php(286): WC_Gateway_BtcPay->ipn_callback('')
#1 /var/www/html/wp-includes/class-wp-hook.php(310): WP_Hook->apply_filters('', Array)
#2 /var/www/html/wp-includes/plugin.php(453): WP_Hook->do_action(Array)
#3 /var/www/html/wp-content/plugins/woocommerce/includes/class-wc-api.php(97): do_action('woocommerce_api...')
#4 /var/www/html/wp-includes/class-wp-hook.php(286): WC_API->handle_api_requests(Object(WP))
#5 /var/www/html/wp-includes/class-wp-hook.php(310): WP_Hook->apply_filters(NULL, Array)
#6 /var/www/html/wp-includes/plugin.php(515): WP_Hook->do_action(Array)
#7 /var/www/html/wp-includes/class-wp.php(375): do_action_ref_array('parse_request', Array)
#8 /var/www/html/wp-includes/class-wp.php(715): WP->parse_request('')
#9 /var/www/html/wp-includes/func in /var/www/html/wp-content/plugins/btcpay-for-woocommerce/class-wc-gateway-btcpay.php on line 1001

BTCPay logs show as:

`

2/15/2019 11:14:58 AM Invoice 6ayYoquW8SNo21PfKLTny3 new event: invoice_created (1001)
2/15/2019 11:15:00 AM Error while sending IPN (1001 invoice_created): Unexpected return code: 500
2/15/2019 11:15:54 AM Invoice 6ayYoquW8SNo21PfKLTny3 new event: invoice_receivedPayment (1002)
2/15/2019 11:15:55 AM Invoice status is paid
2/15/2019 11:15:55 AM Invoice 6ayYoquW8SNo21PfKLTny3 new event: invoice_paidInFull (1003)
2/15/2019 11:15:55 AM IPN (1002 invoice_receivedPayment) sent for invoice 6ayYoquW8SNo21PfKLTny3
2/15/2019 11:15:57 AM IPN (1003 invoice_paidInFull) sent for invoice 6ayYoquW8SNo21PfKLTny3
2/15/2019 11:15:58 AM IPN (1003 invoice_paidInFull) sent for invoice 6ayYoquW8SNo21PfKLTny3
2/15/2019 11:17:37 AM Invoice status is confirmed
2/15/2019 11:17:37 AM Invoice 6ayYoquW8SNo21PfKLTny3 new event: invoice_confirmed (1005)
2/15/2019 11:17:39 AM IPN (1005 invoice_confirmed) sent for invoice 6ayYoquW8SNo21PfKLTny3
2/15/2019 11:17:39 AM IPN (1005 invoice_confirmed) sent for invoice 6ayYoquW8SNo21PfKLTny3
2/15/2019 11:25:00 AM IPN (1001 invoice_created) sent for invoice 6ayYoquW8SNo21PfKLTny3
2/15/2019 11:49:01 AM Invoice status is complete
2/15/2019 11:49:02 AM Invoice 6ayYoquW8SNo21PfKLTny3 new event: invoice_completed (1006)
2/15/2019 11:49:02 AM Invoice 6ayYoquW8SNo21PfKLTny3 is not monitored anymore.
2/15/2019 11:49:02 AM IPN (1006 invoice_completed) sent for invoice 6ayYoquW8SNo21PfKLTny3
2/15/2019 11:49:03 AM IPN (1006 invoice_completed) sent for invoice 6ayYoquW8SNo21PfKLTny3

`

@astupidmoose
Copy link
Contributor Author

astupidmoose commented Mar 3, 2019

Still having the same issue. I'm running 3.0.6 now.

For some reason, woocommerce and btcpay stop talking to each other. BTCPay just starts throwing up Error 500 on every invoice creation request.

2019-03-03 02:57:52.958 -08:00 [INF] Invoice MFqPtE28CUvwbiSDFbSkWu new event: invoice_created (1001)
2019-03-03 02:57:53.655 -08:00 [INF] Error while sending IPN (1001 invoice_created): Unexpected return code: 500
2019-03-03 02:58:20.054 -08:00 [INF] Invoice TdPXSp7dgLu8bjGHmmTyZS new event: invoice_created (1001)
2019-03-03 02:58:20.850 -08:00 [INF] Error while sending IPN (1001 invoice_created): Unexpected return code: 500
2019-03-03 02:59:57.432 -08:00 [INF] Invoice 5w9sH7Gr7sKt5G1bVg8QgZ new event: invoice_created (1001)
2019-03-03 02:59:58.388 -08:00 [INF] Error while sending IPN (1001 invoice_created): Unexpected return code: 500

The only way to fix this is completely restarting btcpay which allows it to start generating invoices again. That leads me to beleive its a BTCPay issue more then a plugin one.

@NicolasDorier
Copy link
Member

I know the issue. invoice_created IPN is sent before php saved the invoice in the DB.
This should not impact anything though. The rest of notification should works fine right?

@cryptofuture
Copy link

cryptofuture commented Apr 22, 2019

@Kukks
Have the same with 3.0.6 and woocommerce 3.6.1
Basically I could see a call to /wc-api/WC_Gateway_BtcPay/ from btcpayserver with all json data, but reply from a server is 500.
In plugin log:
[Error] The BTCPay payment plugin was called to process an IPN message but could not obtain the order ID from the invoice.
If I try to log . $order_id or . $responseData those are empty
Btcpayserver constantly tries to send IPN, but all its receiving is 500.

@astupidmoose
Copy link
Contributor Author

@cryptofuture are you running on an SSD?

The solution for me ended up switching to an SSD setup as I was running on sata before. The issue was that the invoice was taking too long to create for woocommerce with sata

@cryptofuture
Copy link

cryptofuture commented Apr 22, 2019

@cryptofuture are you running on an SSD?

The solution for me ended up switching to an SSD setup as I was running on sata before. The issue was that the invoice was taking too long to create for woocommerce with sata

On SSD RAID10

@NicolasDorier
Copy link
Member

@cryptofuture it does that for every invoice or only once in a while?

@cryptofuture
Copy link

cryptofuture commented Apr 23, 2019

@cryptofuture it does that for every invoice or only once in a while?

For an every invoice. Error in the log says:

[Error] The BTCPay payment plugin was called to process an IPN message but could not obtain the order ID from the invoice.

But from what i think there is an issue with $invoice = $client->getInvoice($json['id']); but it passes the check: [Info] The IPN check appears to be valid.

As i said if I try to log . $responseData its empty

But what I could say 100% is that btcpayserver sending data on /wc-api/WC_Gateway_BtcPay/ correctly

Screenshot from 2019-04-23 04-35-54

@NicolasDorier
Copy link
Member

@cryptofuture can you see, in the order metadata if you have BTCPay_id or BTCPay_rate or something like this?

@NicolasDorier
Copy link
Member

NicolasDorier commented Apr 23, 2019

do you have a orderId field in your btcpay invoice?

@NicolasDorier
Copy link
Member

When you go inside btcpay's invoice details do you see an order id?

@cryptofuture
Copy link

cryptofuture commented Apr 23, 2019

When you go inside btcpay's invoice details do you see an order id?

Yes, it also has hyperlink to the woocommerce order-received (redirectUrl) on it in the interface
But, in the data that is send to /wc-api/WC_Gateway_BtcPay/ I didn't found orderId. It should be there, right?

@NicolasDorier
Copy link
Member

@cryptofuture see

image

@cryptofuture
Copy link

Yes, I have it

@NicolasDorier
Copy link
Member

Damn, I don't know how this can happen...

look https://github.com/btcpayserver/woocommerce-plugin/blob/master/src/class-wc-gateway-btcpay.php#L964

This is where we get the orderId after querying the API.
If you have the orderId this should not be empty or null.... Do you have a way to poke around this code to find what happen?

@NicolasDorier
Copy link
Member

For example, you can try to print

$client->getResponse()->getBody() if you can

@cryptofuture
Copy link

$client->getResponse()->getBody()

Trying now.
That is full data that is btcpayserver sending to the /wc-api/WC_Gateway_BtcPay/ btw

{
  "id": "JiNQgy89Cyf8fmuGsPKbuA",
  "url": "https://mybtcpayserver/invoice?id=JiNQgy89Cyf8fmuGsPKbuA",
  "posData": null,
  "status": "confirmed",
  "btcPrice": "0.00155163",
  "price": 8.0,
  "currency": "USD",
  "invoiceTime": 1555329871000,
  "expirationTime": 1555330771000,
  "currentTime": 1555330028152,
  "btcPaid": "0.00155163",
  "btcDue": "0.00000000",
  "rate": 5155.88959990332,
  "exceptionStatus": false,
  "buyerFields": {
    "buyerEmail": "[email protected]"
  },
  "transactionCurrency": null,
  "paymentSubtotals": {
    "btc": 155163
  },
  "paymentTotals": {
    "btc": 155163
  },
  "amountPaid": "0.00000000",
  "exchangeRates": {
    "btc": {
      "usd": 0.0
    }
  }
}

@NicolasDorier
Copy link
Member

No orderId...

can you go to https://your.btcpayserver.example.org/invoices/JiNQgy89Cyf8fmuGsPKbuA and tell me your Order Id?

@cryptofuture
Copy link

cryptofuture commented Apr 23, 2019

If I tried to pair with proxified version of btcpayserver and it would stop even earlier on invoice generation here:

$this->log(' [Info] Call to generate invoice was successful: ' . $client->getResponse()->getBody()); with the same Client is: Status Code: 401; Unauthorized

So yes, for some reason when I use btcpayserver directly I could generate invoice, but couldn't get it.

How I could log all request data its sending to get invoice? So I could try to curl it directly on machine that is running btcpayserver.

@NicolasDorier
Copy link
Member

@cryptofuture I think I know what is going on in your case.
You have a proxy in the between woocommerce and BTCPay that is not the docker?
If so, then the problem is probably that the proxy is rewriting the HOST header.

@cryptofuture
Copy link

Request to the /invoices/:invoiceId should be signed?

This is what I see in the tcpdump (I wonder where x-identity and x-signature had lost?)

GET /invoices/GMA6BLqBp7M5hfp1qH2STo HTTP/1.0
Host: 127.0.0.1
Connection: close
Accept-Encoding: gzip
CF-IPCountry: CA
X-Forwarded-For: x.x.x.x
CF-RAY: 4cbe58ed4a4ec5e6-EWR
X-Forwarded-Proto: https
CF-Visitor: {"scheme":"https"}
Accept: */*
Content-Type: application/json
X-BitPay-Plugin-Info: BitPay PHP-Client/2.2.20
User-Agent: BitPay PHP-Client/2.2.20 (PHP 7.2.15-0ubuntu0.18.04.2)
X-Accept-Version: 2.0.0
CF-Connecting-IP: x.x.x.x
CDN-Loop: cloudflare

But even if in btcpayserver machine, if I do something like

curl 'http://127.0.0.1:23001/invoices/GMA6BLqBp7M5hfp1qH2STo' -H 'Accept: */*' -H 'Content-Type: application/json' -H 'X-Accept-Version: 2.0.0'

It ends with Status Code: 401; Unauthorized

@NicolasDorier
Copy link
Member

@cryptofuture this is interesting fact. Let me check.

@NicolasDorier
Copy link
Member

same thing with the createInvoice? no signature?

@cryptofuture
Copy link

same thing with the createInvoice? no signature?

Checking now, I launched tcpdump little bit late

  public function getInvoice($invoiceId)
    {
        $this->request = $this->createNewRequest();
        $this->request->setMethod(Request::METHOD_GET);
        if ($this->token && $this->token->getFacade() === 'merchant') {
            $this->request->setPath(sprintf('invoices/%s?token=%s', $invoiceId, $this->token->getToken()));
            $this->addIdentityHeader($this->request);
            $this->addSignatureHeader($this->request);
        } else {
            $this->request->setPath(sprintf('invoices/%s', $invoiceId));
        }
        $this->response = $this->sendRequest($this->request);
        $body = json_decode($this->response->getBody(), true);

        if (isset($body['error'])) {
            throw new \Exception($body['error']);
        }

        $data = $body['data'];

        $invoice = new \Bitpay\Invoice();
        $invoice = $this->fillInvoiceData($invoice, $data);

        return $invoice;
    }
 

Based on this code it must have x-identity and x-signature

@NicolasDorier
Copy link
Member

In your logs

$this->log('    [Info] $this->api_token          = ' . $this->api_token);

the api_token is just a string right, not JSON ?

@cryptofuture
Copy link

the api_token is just a string right, not JSON ?

In your logs

$this->log('    [Info] $this->api_token          = ' . $this->api_token);

the api_token is just a string right, not JSON ?

Its a long string that is looks like its base64 in the log. Ends with ==

@NicolasDorier
Copy link
Member

Ok now I am wondering why all of this ever worked for anybody... one sec

@NicolasDorier
Copy link
Member

@cryptofuture do you see something like this in the logs "[Info] API Token decrypted successfully."

@NicolasDorier
Copy link
Member

I just checked actually this should work.... the api_token is set from what you get at pairing time.
Then serialized and encrypted.

When a new invoice need to be created, it is deserialized/decrypted.

@NicolasDorier
Copy link
Member

So if ($this->token && $this->token->getFacade() === 'merchant') should definitvely be true.

@NicolasDorier
Copy link
Member

have you BTCpay v1.0.3.94 ? I recently made some changes so all tokens are always merchant tokens.

@cryptofuture
Copy link

cryptofuture commented Apr 23, 2019

have you BTCpay v1.0.3.94 ? I recently made some changes so all tokens are always merchant tokens.

git rev-parse HEAD shows 3cce7b8b35705b2ed424964f03d3dd463f488f42

I checked the post the invoices and it contains x-identity and x-signature, so the problem is only with get on /invoices/:invoiceId as its not signed for some reason

I recently made some changes so all tokens are always merchant tokens

Hmm, I use pos facade in some of my code, well would check later. But I wonder it would break older pos tokens, when I update?

POST /invoices HTTP/1.0
Host: 127.0.0.1
Connection: close
Content-Length: 572
Accept-Encoding: gzip
CF-IPCountry: CA
X-Forwarded-For: x.x.x.x
CF-RAY: 4cbea7151dd757c5-IAD
X-Forwarded-Proto: https
CF-Visitor: {"scheme":"https"}
Accept: */*
Content-Type: application/json
X-BitPay-Plugin-Info: BitPay PHP-Client/2.2.20
User-Agent: BitPay PHP-Client/2.2.20 (PHP 7.2.15-0ubuntu0.18.04.2)
X-Accept-Version: 2.0.0
x-identity: 030df3c2b139568020b2829exxce48f5290ad3ef44d0dxxdf158f1d89xx275e922
x-signature: 3045022100xx869c791cxx5947116bfe952cbb77076be4ed2a43428638486b0291687fb160022077cxxba0ca96916e38081f2b1d9c6b4cdd0e6xxc03a99a853bfe82a024dda391
CF-Connecting-IP: x.x.x.x
CDN-Loop: cloudflare

@NicolasDorier
Copy link
Member

So that's why! Update to the latest stable (the latest branch)

In last versions, I removed the concept of facade. Now user facade input is ignored, and the API always returns merchant.

@cryptofuture
Copy link

cryptofuture commented Apr 23, 2019

So that's why! Update to the latest stable (the latest branch)

In last versions, I removed the concept of facade. Now user facade input is ignored, and the API always returns merchant.

I'll but how this would help to sign GET /invoices/:invoiceId in the plugin, it seems the problem is that GET /invoices/:invoiceId doesn't have x-identity and x-signature?

@NicolasDorier
Copy link
Member

Because when you pair your store, you need to select merchant as facade. Your problem is that you are using pos.

I think in both case you need to repair and select merchant.

@cryptofuture
Copy link

cryptofuture commented Apr 23, 2019

Because when you pair your store, you need to select merchant as facade. Your problem is that you are using pos.

I think in both case you need to repair and select merchant.

OK would try. Could confirm facade is pos

@NicolasDorier
Copy link
Member

New versions just removed the Facade option so people can't screw up.

@cryptofuture
Copy link

Same thing with merchant facade. GET on /invoices/:invoiceId is not signed. api_token is a string now.

@cryptofuture
Copy link

Works now after btcpayserver update, and another re-pairing also in webserver logs reply on /wc-api/WC_Gateway_BtcPay/ is 200 now.

04-23-2019 @ 10:00:48 -     [Info] Order ID is: 110
04-23-2019 @ 10:00:48 -     [Info] Order details retrieved successfully...
04-23-2019 @ 10:00:48 -     [Info] Receiving IPN for an order which has no expected invoice ID, ignoring the IPN...

And


4/23/2019 9:46:22 AM | Creation of invoice starting
-- | --
4/23/2019 9:46:22 AM | BTC_USD: The rating rule is coinaverage(BTC_USD)
4/23/2019 9:46:22 AM | BTC_USD: The evaluated rating rule is 5523.59814104374
4/23/2019 9:46:22 AM | LTC_USD: The rating rule is coinaverage(LTC_USD)
4/23/2019 9:46:22 AM | LTC_USD: The evaluated rating rule is 78.4035815867632
4/23/2019 9:46:22 AM | BTC (Off-Chain): Payment method details creation took 35 milliseconds
4/23/2019 9:46:22 AM | BTC (On-Chain): Payment method details creation took 158 milliseconds
4/23/2019 9:46:22 AM | LTC (On-Chain): Payment method details creation took 259 milliseconds
4/23/2019 9:46:22 AM | Saving invoice took 15 milliseconds
4/23/2019 9:46:22 AM | Invoice V85N2bavmaSa6sXPBjbEUC new event: invoice_created (1001)
4/23/2019 9:46:23 AM | IPN (1001 invoice_created) sent for invoice V85N2bavmaSa6sXPBjbEUC
4/23/2019 9:51:12 AM | Invoice V85N2bavmaSa6sXPBjbEUC new event: invoice_receivedPayment (1002)
4/23/2019 9:51:12 AM | Invoice status is paid
4/23/2019 9:51:12 AM | Invoice V85N2bavmaSa6sXPBjbEUC new event: invoice_paidInFull (1003)
4/23/2019 9:51:13 AM | IPN (1002 invoice_receivedPayment) sent for invoice V85N2bavmaSa6sXPBjbEUC
4/23/2019 9:51:14 AM | IPN (1003 invoice_paidInFull) sent for invoice V85N2bavmaSa6sXPBjbEUC
4/23/2019 9:51:15 AM | IPN (1003 invoice_paidInFull) sent for invoice V85N2bavmaSa6sXPBjbEUC
4/23/2019 9:52:22 AM | Invoice status is confirmed
4/23/2019 9:52:22 AM | Invoice V85N2bavmaSa6sXPBjbEUC new event: invoice_confirmed (1005)
4/23/2019 9:52:23 AM | IPN (1005 invoice_confirmed) sent for invoice V85N2bavmaSa6sXPBjbEUC
4/23/2019 9:52:23 AM | IPN (1005 invoice_confirmed) sent for invoice V85N2bavmaSa6sXPBjbEUC
4/23/2019 10:00:45 AM | Invoice status is complete
4/23/2019 10:00:45 AM | Invoice V85N2bavmaSa6sXPBjbEUC new event: invoice_completed (1006)
4/23/2019 10:00:45 AM | Invoice V85N2bavmaSa6sXPBjbEUC is not monitored anymore.
4/23/2019 10:00:48 AM | IPN (1006 invoice_completed) sent for invoice V85N2bavmaSa6sXPBjbEUC
4/23/2019 10:00:48 AM | IPN (1006 invoice_completed) sent for invoice V85N2bavmaSa6sXPBjbEUC

But in woocommerce Orders lists it still marked as Pending payment should I create new issue for that?

So if select wp-admin/post.php?post=110&action=edit there is nothing new there, and in the woocommerce interface the status is still Pending payment

@NicolasDorier
Copy link
Member

@cryptofuture the default parameter should be good, but in the settings of the plugin you can map confirmed BTCPay state to any of the woocommerce state you want.

@DNSTARS
Copy link

DNSTARS commented Jun 9, 2019

We're having a similar issue currently. I've detached our self hosted BTCPay server and connected it to BTCPayJungle and we're looking at this:

image

Woo logs state:

06-09-2019 @ 19:56:53 - [Error] The BTCPay payment plugin was called to process an IPN message but could not retrieve the order details for order_id: "6808". If you use an alternative order numbering system, please see class-wc-gateway-btcpay.php to apply a search filter.

Removed and re-added the plug in / paired and added this snippet from the FAQ since it suggests it is the error:

image

This is happening on every invoice now.

@NicolasDorier
Copy link
Member

@Kukks any idea?

@astupidmoose
Copy link
Contributor Author

@DNSTARS are you using a custom numbering system in woocommerce?

@DNSTARS
Copy link

DNSTARS commented Jun 10, 2019

Sorry to waste your time, I've gone backwards through all the logs and it seems our X-Frame-Options in WP was changed, given the earlier comments I'll see what is going on there. I think this one is probably a silly issue my side. We went from X-Frame-Options DENY to Header always set X-Frame-Options ALLOW and possibly a few other bits at the exact time this all started.

Made a new WP and threw woo/plug in and BTCPayjungle toether and it works fine - sorry lads.

@k3tan172
Copy link

@DNSTARS I'm getting the same issue as you've described. My 'payment pending' isn't turning to 'processing' because of this IPN issue. What did you do to fix?

@DNSTARS
Copy link

DNSTARS commented Jun 12, 2019

I didn't fix it per se, I just tried BTCPay on a fresh install of WP/Woo and it works, one thing I did notice was that we're on PHP7.0X on debian where it's not working and the test version where it is working is PHP7.2 on ubuntu, that may or may not be significant.

Incidentally our X-Frame options had been set to just "ALLOW" which apparently isn't a valid argument, deleting it out is the expected answer to "Allow", having done that though our issue remained.

Update: 12/06

WooCommerce Admin A new JavaScript-driven interface for managing your store. The plugin includes new and improved reports, and a dashboard to monitor all the important key metrics of your site. Version 0.12.0
By WooCommerce | View details_

This was the culprit - turn it off and see what errors you get your side @k3tan172 , turning this on and off directly matches the IPN 500 errors on BTCPay. The funny thing is I'd turned it back on previously since it had no effect on the issue whilst I was fixing other stuff. Live and learn.

@k3tan172
Copy link

I can confirm this was 100% the culprit. Deactivate the Woocommerce Admin plugin and it works like a charm.
Thank you so much for this @DNSTARS
It was doing my head in!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants