News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

PayPal Sandbox IPN unstable

Started by SimonDG, January 12, 2018, 09:58:29 AM

Previous topic - Next topic

SimonDG

Hello everyone,

So I am using Joomla! 3.8.3 and VirtueMart 3.2.12 on an online test environment (i.e. "https://test.domain.ch").
I was testing paypal, and everything seemed to work fine—order statuses changed and money went from the sandbox-buyer account to the sandbox-facilitator account.
In my sandbox-facilitator settings, Auto Return for Website Payments is activated and makes customers return to https://test.domain.ch/index.php?option=com_virtuemart&view=pluginresponse&task=pluginresponsereceived. Also, IPN is activated, with the notification URL being https://www.test.domain.ch/index.php.

However, yesterday from 5pm CET onwards, order statuses did not change from pending, which prompted me to do some long hours to fix the issue. Unfortunately, order statuses did not change from pending, regardless of what I did. I did about 15 mock transactions, and the status was pending for all of them.

For these transactions, the paypal log file shows the following:


2018-01-11 20:36:21 DEBUG plgVmConfirmedOrder: order number: QH9Z0379
2018-01-11 20:36:21 MESSAGE plgVmConfirmedOrder: Amount/Currency stored 63.7 paymentcurrency 27 orderusercurrency27
2018-01-11 20:36:21 DEBUG PayPal request:: Array
(
    [cmd] => _ext-enter
    [redirect_cmd] => _xclick
    [paymentaction] => sale
    [upload] => 1
    [business] => info-facilitator@email.ch
    [receiver_email] => info-facilitator@email.ch
    [order_number] => QH9Z0379
    [invoice] => QH9Z0379
    [custom] => vsquk83mi3me6kjf1qiib4c1j4
    [currency_code] => CHF
    [address_override] => 0
    [first_name] => first name
    [last_name] => last name
    [address1] => Address
    [address2] =>
    [zip] => Zip Code
    [city] => City
    [state] =>
    [country] =>
    [email] => my.email@gmail.com
    [night_phone_b] =>
    [return] => https://www.test.domain.ch/index.php?option=com_virtuemart&view=vmplg&task=pluginresponsereceived&on=QH9Z0379&pm=5&Itemid=518
    [notify_url] => https://www.test.domain.ch/index.php?option=com_virtuemart&view=vmplg&task=notify&tmpl=component&lang=
    [cancel_return] => https://www.test.domain.ch/index.php?option=com_virtuemart&view=vmplg&task=pluginUserPaymentCancel&on=QH9Z0379&pm=5&Itemid=518&lang=
    [rm] => 2
    [bn] => VirtueMart_Cart_PPA
    [no_shipping] => 1
    [no_note] => 1
    [image_url] => https://www.test.domain.ch/images/stories/virtuemart/vendor/EshopLogoMail.jpg
    [item_name] => Bestellnummer: QH9Z0379
    [amount] => 63.7
)

2018-01-11 20:37:06 DEBUG plgVmOnPaymentResponseReceived: stdClass Object
(
    [id] => 24
    [virtuemart_order_id] => 396
    [order_number] => QH9Z0379
    [virtuemart_paymentmethod_id] => 5
    [payment_name] => <span class="vmpayment_name">PayPal</span> <span style="color:red;font-weight:bold">Sandbox (5)</span>
    [paypal_response_pending_reason] => 0
    [payment_order_total] => 63.70000
    [payment_currency] => 27
    [paypal_method] => 0
    [paypal_fullresponse] => 0
    [email_currency] => 27
    [paypal_response_txn_id] => 0
    [paypal_response_txn_type] => 0
    [paypal_response_parent_txn_id] => 0
    [paypal_response_case_creation_date] => 0
    [paypal_response_case_id] => 0
    [paypal_response_case_type] => 0
    [paypal_response_reason_code] => 0
    [cost_per_transaction] => 0.00
    [cost_percent_total] => 0.00
    [tax_id] => 0
    [paypal_custom] => vsquk83mi3me6kjf1qiib4c1j4
    [paypal_response_mc_gross] => 0.00
    [paypal_response_mc_currency] => 0
    [paypal_response_invoice] => 0
    [paypal_response_protection_eligibility] => 0
    [paypal_response_payer_id] => 0
    [paypal_response_tax] => 0.00
    [paypal_response_payment_date] => 0
    [paypal_response_payment_status] => 0
    [paypal_response_mc_fee] => 0.00
    [paypal_response_payer_email] => 0
    [paypal_response_last_name] => 0
    [paypal_response_first_name] => 0
    [paypal_response_business] => 0
    [paypal_response_receiver_email] => 0
    [paypal_response_transaction_subject] => 0
    [paypal_response_residence_country] => 0
    [paypalresponse_raw] => 0
    [created_on] => 2018-01-11 20:36:21
    [created_by] => 376
    [modified_on] => 2018-01-11 20:36:21
    [modified_by] => 376
    [locked_on] => 0000-00-00 00:00:00
    [locked_by] => 0
)


Interestingly, I received a bunch of confirmation emails this morning. From all the mock transactions I did, all but one changed their status to awaiting payment confirmation.

Now, the paypal log file shows the following:


2018-01-12 07:04:22 DEBUG PaymentNotification, paypal_data:: Array
(
    [transaction_subject] =>
    [payment_date] => 12:04:28 Jan 11, 2018 PST
    [txn_type] => web_accept
    [last_name] => buyer
    [residence_country] => CH
    [pending_reason] => paymentreview
    [item_name] => Bestellnummer: 7VPP0377
    [payment_gross] =>
    [mc_currency] => CHF
    [business] => info-facilitator@email.ch
    [payment_type] => instant
    [protection_eligibility] => Ineligible
    [verify_sign] => Akb8wrAZ8Auhkn6CIXzjdSq66j5HA-rest of sign
    [payer_status] => verified
    [test_ipn] => 1
    [payer_email] => info-buyer@email.ch
    [txn_id] => 4XC79953L4130343L
    [quantity] => 1
    [receiver_email] => info-facilitator@email.ch
    [first_name] => test
    [invoice] => 7VPP0377
    [payer_id] => LREXWSHYKZPG6
    [receiver_id] => XN9587XSUWFM8
    [item_number] =>
    [payment_status] => Pending
    [payment_fee] =>
    [mc_fee] => 1.54
    [mc_gross] => 29.25
    [custom] => vsquk83mi3me6kjf1qiib4c1j4
    [charset] => windows-1252
    [notify_version] => 3.8
    [ipn_track_id] => cfb082c0cd3df
)

2018-01-12 07:04:22 DEBUG PaymentNotification, order_number:: 7VPP0377
2018-01-12 07:04:22 DEBUG PaymentNotification, virtuemart_paymentmethod_id:: 5
2018-01-12 07:04:22 DEBUG checkPaypalIps REMOTE ADDRESS: xxx.x.xx.xxx
2018-01-12 07:04:22 DEBUG validateIpnContent: valid_ipn: VERIFIED
0


2018-01-12 07:04:22 DEBUG plgVmOnPaymentNotification: plgVmOnPaymentNotification order_number:7VPP0377 new_status:U
2018-01-12 07:04:22 DEBUG plgVmOnPaymentNotification: plgVmOnPaymentNotification empty cart


While I am happy that the statuses changed and the emails were sent eventually, I am confused about this incident since I have no clue why it took PayPal Sandbox/my website several hours for this, and why one order remained pending.

Is there a "genuine" problem with my website/my paypal sandbox settings, or is it just a quirk of Sandbox that IPN's are sometimes generated with considerable delay?

Greetings from Switzerland,

Simon

jjk

If you want to test IPNs from the PayPal sandbox, I think it is still required to use PayPal's IPN Simulator: https://developer.paypal.com/docs/classic/ipn/integration-guide/IPNSimulator/.
This might help, too: https://developer.paypal.com/docs/classic/lifecycle/sb_payment-review/

The delay might also be due to email forwarded with a long delay by a mail server. Sometimes the sandbox is slow, too.

You do not 'need' to configure the IPN in your PayPal account. PayPal will use the IPN provided by the Plugin



Non-English Shops: Are your language files up to date?
http://virtuemart.net/community/translations

SimonDG

Many thanks for your reply jjk!

Quote from: jjk on January 12, 2018, 10:31:38 AM
If you want to test IPNs from the PayPal sandbox, I think it is still required to use PayPal's IPN Simulator: https://developer.paypal.com/docs/classic/ipn/integration-guide/IPNSimulator/.

I tested the IPN by using https://test.domain.ch/index.php?option=com_virtuemart&view=pluginresponse&task=pluginnotification&tmpl=component as the IPN handler URL. Using the default payment information, the result was IPN was sent and the handshake was verified for all transaction types.

Quote from: jjk on January 12, 2018, 10:31:38 AM
This might help, too: https://developer.paypal.com/docs/classic/lifecycle/sb_payment-review/

For all the aforementioned transactions, payment review was on. While this explains why it took a while until VM sets the order status to confirmed (i.e. goods can safely be shipped), it can't explain why VM does not set the order status to awaiting payment confirmation right away.

Quote from: jjk on January 12, 2018, 10:31:38 AM
The delay might also be due to email forwarded with a long delay by a mail server. Sometimes the sandbox is slow, too.

I modified some scripts in components/com_virtuemart/views/invoice/tmpl since I wanted to change the layout of the emails customers get—could these modifications have led to this issue?

Quote from: jjk on January 12, 2018, 10:31:38 AM
You do not 'need' to configure the IPN in your PayPal account. PayPal will use the IPN provided by the Plugin

Does this mean that, technically, I could leave the IPN in my PayPal account deactivated?

jjk

#3
QuoteDoes this mean that, technically, I could leave the IPN in my PayPal account deactivated?
I'm using PayPal Standard and never activated IPN in my PayPal account settings. It is set to "Do not receive IPN messages (Disabled)". PayPal sends it to the listener built into the plugin anyway and they are logged in the 'Instant Payment Notification (IPN) history'. I think this is an 'outdated' link, but at present it still works for the live IPN history when you are logged in into your PayPal account: https://www.paypal.com/cgi-bin/webscr?cmd=_display-ipns-history
Non-English Shops: Are your language files up to date?
http://virtuemart.net/community/translations

SimonDG

SOLVED: The problem occurred because I used an outdated version of my template.