If this is your first visit, check our documentation. To post, register or login.
Forums / PayPal Express Checkout support / Paypal IPN updates require intervention?

Paypal IPN updates require intervention?

Locked

Started by gernot on 23 May 2021, 7:08 AM · Views: 5,312

Results 1 to 9 of 9
This thread is locked. New replies are disabled.
23 May 2021, 7:08 AM
#1
gernot avatar

gernot

Zen Follower

Join Date:
Feb 2017
Location:
Tokyo, Japan
Posts:
334
Plugin Contributions:
0

Paypal IPN updates require intervention?

site: https://www.proteawines.jp/shop/
OS: Debian 11.0 (64-bit)
Zencart: 1.5.6c with customizations for Japanese language
DB: MariaDB 10.3.24
PHP (with nginx/php-fpm): 7.3.15-3

Paypal send notifications of updates to IPN IP addresses in December 2020, which I ignored since I have no restrictions in my route, OS firewall or nginx web server configuration for HTTPS traffic.

Paypal has been working for transactions, last one was yesterday 22nd May (I could capture the payment successfully in ZenCart, and it is listed in my PayPal account correctly as "pending").

That said, the morning I received a message from Paypal stating that there are IPN errors, and that IPN may be stopped if this continues.

Dear Gernot Hassenpflug,

Please check your server that handles PayPal Instant Payment Notifications (IPN). IPNs sent to the following URL(s) are failing:

https://www.proteawines.jp/shop/ipn_main_handler.php

If you do not recognize this URL, you may be using a service provider that is using IPN on your behalf. Please contact your service provider with the above information. If this problem continues, IPNs may be disabled for your account.

Thank you for your prompt attention to this issue.

PROTECT YOUR PASSWORD

NEVER give your password to anyone, including PayPal employees. Protect yourself against fraudulent websites by opening a new web browser (e.g. Internet Explorer or Firefox) and typing in the PayPal URL every time you log in to your account.

Not sure why you received this email? Learn more [https://www.paypal.com/jp/smarthelp/article/why-am-i-receiving-emails-from-paypal-when-i-dont-have-an-account-faq4172?v=1&utm_source=unp&utm_medium=email&utm_campaign=RT000111&utm_unptid=5ca3f26a-bb89-11eb-8f7c-b875c0b5c533&ppid=RT000111&cnac=JP&rsta=en_US%28en-JP%29&cust=K6V7E9MVTSLL6&unptid=5ca3f26a-bb89-11eb-8f7c-b875c0b5c533&calc=a5c4c469241f6&unp_tpcid=email-ipn-warning&page=main%3Aemail%3ART000111&pgrp=main%3Aemail&e=cl&mchn=em&s=ci&mail=sys&appVersion=1.44.0&xt=104038]

PayPal Pte. Ltd. is a Singaporean company registered with the Financial Services Agency of Japan as a (1) Funds Transfer Business Operator with Registration No. 00026 issued by the Director-General of the Kanto Local Finance Bureau and (2) Third Party-type Issuer of Prepaid Payment Instruments with Registration No. 00705 issued by the Director-General of the Kanto Local Finance Bureau.

PayPal RT000111:en_US(en-JP):1.0.0:a5c4c469241f6

I checked as best I could the Paypal module code, there is no explicit listings of IP addresses.
In the ZenCart error logs there are errors of this form:

[23-May-2021 12:39:49 Asia/Tokyo] Request URI: /shop/ipn_main_handler.php, IP address: 173.0.81.65
#1 trigger_error() called at [/<snipped>/includes/classes/db/mysql/query_factory.php:171]
#2 queryFactory->show_error() called at [/<snipped>/includes/classes/db/mysql/query_factory.php:143]
#3 queryFactory->set_error() called at [/<snipped>/includes/classes/db/mysql/query_factory.php:270]
#4 queryFactory->Execute() called at [/<snipped>/includes/functions/functions_general.php:952]
#5 zen_db_perform() called at [/<snipped>/ipn_main_handler.php:439]
--> PHP Fatal error: 1366:Incorrect integer value: '' for column zencartshop.paypal_payment_status_history.paypal_ipn_id at row 1 :: INSERT INTO paypal_payment_status_history (paypal_ipn_id, txn_id, parent_txn_id, payment_status, pending_reason, date_added) VALUES ('', '5****************', '1****************', 'Completed', '', now()) ==> (as called by) /<snipped>/includes/functions/functions_general.php on line 952 <== in /<snipped>/includes/classes/db/mysql/query_factory.php on line 171.(DB values replaced by asterisks, paths snipped)

Not sure if there is anything I need to do regarding IPN IP addresses, or whether the error is caused by, say, strict mode in the DB?

Any comments appreciated.

Zen Cart 1.5.6c modified for Japanese language support. Upgraded incrementally from initial 1.5.5d. Currently planning direct upgrade to 2.1.0

23 May 2021, 1:19 PM
#2
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,142
Plugin Contributions:
56

Re: Paypal IPN updates require intervention?

@gernot, do you, by any chance, have the PayPal debug-to-file enabled? That would (have) gathered some of the information needed to further understand the source of the error.

23 May 2021, 10:31 PM
#3
gernot avatar

gernot

Zen Follower

Join Date:
Feb 2017
Location:
Tokyo, Japan
Posts:
334
Plugin Contributions:
0

Re: Paypal IPN updates require intervention?

Hello @lat9,
Thank you for your response. I had not, but I have enabled it now.
I notice in my logs I have these kinds of errors from October 4th 2020, so I assume they are not directly related to the IP address changes rolled out in December.
I hope I will see something in the extra logs today, or whenever Paypal initiates some kind of checking.

Zen Cart 1.5.6c modified for Japanese language support. Upgraded incrementally from initial 1.5.5d. Currently planning direct upgrade to 2.1.0

24 May 2021, 2:34 PM
#4
gernot avatar

gernot

Zen Follower

Join Date:
Feb 2017
Location:
Tokyo, Japan
Posts:
334
Plugin Contributions:
0

Re: Paypal IPN updates require intervention?

Hi @lat9,
After activating "log to file" I got a more extensive error log:

-rw-r--r-- 1 www-data www-data 10840 May 24 11:25 ipn_1621823114_YxlQ3.log
ipn_1621823114_YxlQ3.log
May 24 2021 11:25 -- IPN PROCESSING INITIATED.
*** Originating IP: 173.0.81.65 notify.paypal.com
*** Browser/User Agent: PayPal IPN ( https://www.paypal.com/ipn )

May 24 2021 11:25 -- Breakpoint: 0 - Initializing debugging.

May 24 2021 11:25 -- Breakpoint: Flag Status:
isECtransaction = 1
isDPtransaction = 0

May 24 2021 11:25 -- IPN INFO - POST VARS received (sorted):
Array
(
[address_city] => <snipped>
[address_country] => Japan
[address_country_code] => JP
[address_name] => <snipped>
[address_state] => Tokyo
[address_status] => confirmed
[address_street] => <snipped>
[address_zip] => <snipped>
[auth_amount] => <snipped>
[auth_exp] => 19:46:42 Jun 19, 2021 PDT
[auth_id] => 1****************
[auth_status] => Completed
[business] => <snipped>
[charset] => windows-1252
[custom] => EC-**-**********
[discount] => 0
[first_name] => <snipped>
[insurance_amount] => 0
[invoice] => --[ProteaWinesJapan]
[ipn_track_id] => <snipped>
[item_name1] => <snipped>
[item_name2] => <snipped>
[item_name3] => <snipped>
[item_name4] => <snipped>
[item_name5] => <snipped>
[item_number1] => <snipped>
[item_number2] => <snipped>
[item_number3] => <snipped>
[item_number4] => <snipped>
[item_number5] => <snipped>
[last_name] => <snipped>
[mc_currency] => JPY
[mc_fee] => <snipped>
[mc_gross] => <snipped>
[mc_gross_1] => <snipped>
[mc_gross_2] => <snipped>
[mc_gross_3] => <snipped>
[mc_gross_4] => <snipped>
[mc_gross_5] => <snipped>
[mc_handling] => 0
[mc_handling1] => 0
[mc_handling2] => 0
[mc_handling3] => 0
[mc_handling4] => 0
[mc_handling5] => 0
[mc_shipping] => 0
[mc_shipping1] => 0
[mc_shipping2] => 0
[mc_shipping3] => 0
[mc_shipping4] => 0
[mc_shipping5] => 0
[memo] => Thank you for your order.
[notify_version] => 3.9
[num_cart_items] => 5
[option_name1_1] =>
[option_name2_1] =>
[option_name3_1] =>
[option_name4_1] =>
[option_name5_1] =>
[option_selection1_1] =>
[option_selection2_1] =>
[option_selection3_1] =>
[option_selection4_1] =>
[option_selection5_1] =>
[parent_txn_id] => 1
****
[payer_email] => <snipped>
[payer_id] => <snipped>
[payer_status] => unverified
[payment_date] => 21:52:54 May 21, 2021 PDT
[payment_fee] =>
[payment_gross] =>
[payment_status] => Completed
[payment_type] => instant
[protection_eligibility] => Eligible
[quantity1] => 1
[quantity2] => 1
[quantity3] => 1
[quantity4] => 1
[quantity5] => 1
[receiver_email] => <snipped>
[receiver_id] => <snipped>
[remaining_settle] => 0
[residence_country] => JP
[shipping_discount] => 0
[shipping_method] => Default
[tax] => <snipped>
[tax1] => 0
[tax2] => 0
[tax3] => 0
[tax4] => 0
[tax5] => 0
[transaction_entity] => payment
[transaction_subject] =>
[txn_id] => 5****************
[txn_type] => cart
[verify_sign] => A6P0mz
)

May 24 2021 11:25 -- IPN INFO - POST VARS to be sent back (unsorted) for validation (using CURL):
To: ipnpb.paypal.com:443
Array
(
[cmd] => _notify-validate
[option_selection3_1] =>
[invoice] => --[ProteaWinesJapan]
[first_name] => <snipped>
[discount] => 0
[mc_shipping] => 0
[mc_currency] => JPY
[payer_status] => unverified
[shipping_discount] => 0
[payment_fee] =>
[option_name4_1] =>
[address_status] => confirmed
[payment_gross] =>
[address_zip] => <snipped>
[address_country_code] => JP
[mc_handling] => 0
[num_cart_items] => 5
[txn_type] => cart
[verify_sign] => <snipped>
[payer_id] => <snipped>
[option_selection2_1] =>
[charset] => windows-1252
[auth_id] => 1
****
[transaction_entity] => payment
[tax1] => 0
[receiver_id] => <snipped>
[tax2] => 0
[tax3] => 0
[tax4] => 0
[tax5] => 0
[mc_handling1] => 0
[mc_handling2] => 0
[option_name3_1] =>
[mc_handling3] => 0
[mc_handling4] => 0
[mc_handling5] => 0
[tax] => 7100
[item_name1] => <snipped>
[item_name2] => <snipped>
[item_name3] => <snipped>
[item_name4] => <snipped>
[payment_type] => instant
[item_name5] => <snipped>
[option_selection5_1] =>
[address_street] => <snipped>
[mc_shipping1] => 0
[mc_shipping2] => 0
[mc_shipping3] => 0
[txn_id] => 5****************
[mc_shipping4] => 0
[mc_shipping5] => 0
[mc_gross_1] => <snipped>
[quantity1] => 1
[mc_gross_2] => <snipped>
[quantity2] => 1
[item_number1] => <snipped>
[protection_eligibility] => Eligible
[mc_gross_3] => <snipped>
[quantity3] => 1
[item_number2] => <snipped>
[mc_gross_4] => <snipped>
[quantity4] => 1
[item_number3] => <snipped>
[custom] => EC-**-**********
[mc_gross_5] => <snipped>
[quantity5] => 1
[item_number4] => <snipped>
[option_selection1_1] =>
[item_number5] => <snipped>
[business] => <snipped>
[residence_country] => JP
[last_name] => <snipped>
[address_state] => <snipped>
[payer_email] => <snipped>
[option_name2_1] =>
[auth_exp] => 19:46:42 Jun 19, 2021 PDT
[address_city] => <snipped>
[option_selection4_1] =>
[payment_status] => Completed
[payment_date] => 21:52:54 May 21, 2021 PDT
[parent_txn_id] => 1****************
[transaction_subject] =>
[receiver_email] => <snipped>
[mc_fee] => 2852
[notify_version] => 3.9
[remaining_settle] => 0
[option_name5_1] =>
[shipping_method] => Default
[auth_status] => Completed
[address_country] => Japan
[mc_gross] => <snipped>
[insurance_amount] => 0
[address_name] => <snipped>
[option_name1_1] =>
[memo] => Thank you for your order.
[auth_amount] => <snipped>
[ipn_track_id] => <snipped>
)

May 24 2021 11:25 -- CURL OPTS: Array
(
[10002] => https://ipnpb.paypal.com/cgi-bin/webscr
[47] => 1
[10015] => cmd=_notify-validate&option_selection3_1=&invoice=49-1621651601-%5BProteaWinesJapan%5D&first_name=<snipped>&discount=0&mc_shipping=0&mc_currency=JPY&payer_status=unverified&shipping_discount=0&payment_fee=&option_name4_1=&address_status=confirmed&payment_gross=&address_zip=<snipped>&address_country_code=JP&mc_handling=0&num_cart_items=5&txn_type=cart&verify_sign=<snipped>&payer_id=<snipped>&option_selection2_1=&charset=windows-1252&auth_id=1****************&transaction_entity=payment&tax1=0&receiver_id=<snipped>=0&tax3=0&tax4=0&tax5=0&mc_handling1=0&mc_handling2=0&option_name3_1=&mc_handling3=0&mc_handling4=0&mc_handling5=0&tax=<snipped>&item_name1=<snipped>&item_name2=<snipped>&item_name3=<snipped>&item_name4=<snipped>&payment_type=instant&item_name5=<snipped>&option_selection5_1=&address_street=<snipped>&mc_shipping1=0&mc_shipping2=0&mc_shipping3=0&txn_id=5****************&mc_shipping4=0&mc_shipping5=0&mc_gross_1=<snipped>&quantity1=1&mc_gross_2=<snipped>&quantity2=1&item_number1=<snipped>&protection_eligibility=Eligible&mc_gross_3=<snipped>&quantity3=1&item_number2=<snipped>&mc_gross_4=<snipped>&quantity4=1&item_number3=<snipped>&custom=EC-**-&mc_gross_5=<snipped>&quantity5=1&item_number4=<snipped>&option_selection1_1=&item_number5=<snipped>&business=<snipped>&residence_country=JP&last_name=<snipped>&address_state=<snipped>&payer_email=<snipped>&option_name2_1=&auth_exp=19%3A46%3A42+Jun+19%2C+2021+PDT&address_city=<snipped>&option_selection4_1=&payment_status=Completed&payment_date=21%3A52%3A54+May+21%2C+2021+PDT&parent_txn_id=1******&transaction_subject=&receiver_email=<snipped>&mc_fee=<snipped>&notify_version=3.9&remaining_settle=0&option_name5_1=&shipping_method=Default&auth_status=Completed&address_country=Japan&mc_gross=<snipped>&insurance_amount=0&address_name=<snipped>&option_name1_1=&memo=Thank+you+for+your+order.&auth_amount=<snipped>&ipn_track_id=<snipped>
[13] => 45
[78] => 30
[41] =>
[42] =>
[52] =>
[19913] => 1
[75] => 1
[74] => 1
[84] => 2
[10018] => Zen Cart(R) - IPN Postback
)

May 24 2021 11:25 -- CURL response: VERIFIED

May 24 2021 11:25 -- IPN INFO (cl) - Confirmation/Validation response VERIFIED

May 24 2021 11:25 -- Breakpoint: 1 - Collected data from PayPal notification

May 24 2021 11:25 -- Breakpoint: 2 - Validated transaction components

May 24 2021 11:25 -- Breakpoint: 3 - Communication method verified

May 24 2021 11:25 -- IPN NOTICE :: This transaction HAS a parent record. Thus this is an update of some sort.

May 24 2021 11:25 -- Breakpoint: 4 - Details: txn_type=parent ordersID = 125 IPN_id=**

Relevant data from POST:
txn_type = parent
parent_txn_id = 1****************
txn_id = 5****************

May 24 2021 11:25 -- Breakpoint: 5 - Transaction type (txn_type) = cleared-authorization [parentLookup=parent]

May 24 2021 11:25 -- IPN NOTICE :: Storing order/update details for order #125 txn_id: 5**************** PP IPN ID: **

[24-May-2021 11:25:16 Asia/Tokyo] Request URI: /shop/ipn_main_handler.php, IP address: 173.0.81.65
#1 trigger_error() called at [/<snipped>/shop/includes/classes/db/mysql/query_factory.php:171]
#2 queryFactory->show_error() called at [/<snipped>/shop/includes/classes/db/mysql/query_factory.php:143]
#3 queryFactory->set_error() called at [/<snipped>/shop/includes/classes/db/mysql/query_factory.php:270]
#4 queryFactory->Execute() called at [/<snipped>/shop/includes/functions/functions_general.php:952]
#5 zen_db_perform() called at [/<snipped>/shop/ipn_main_handler.php:439]
--> PHP Fatal error: 1366:Incorrect integer value: '' for column zencartshop.paypal_payment_status_history.paypal_ipn_id at row 1 :: INSERT INTO paypal_payment_status_history (paypal_ipn_id, txn_id, parent_txn_id, payment_status, pending_reason, date_added) VALUES ('', '5****************', '1****************', 'Completed', '', now()) ==> (as called by) /<snipped>/shop/includes/functions/functions_general.php on line 952 <== in /<snipped>/shop/includes/classes/db/mysql/query_factory.php on line 171.

Zen Cart 1.5.6c modified for Japanese language support. Upgraded incrementally from initial 1.5.5d. Currently planning direct upgrade to 2.1.0

24 May 2021, 9:27 PM
#5
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,512
Plugin Contributions:
176

Re: Paypal IPN updates require intervention?

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

25 May 2021, 1:26 AM
#6
gernot avatar

gernot

Zen Follower

Join Date:
Feb 2017
Location:
Tokyo, Japan
Posts:
334
Plugin Contributions:
0

Re: Paypal IPN updates require intervention?

DrByte,
Many thanks, I had been following backported fixes but missed this one. Applied it now, will see what happens after I make an update to the Paypal order shortly.

Zen Cart 1.5.6c modified for Japanese language support. Upgraded incrementally from initial 1.5.5d. Currently planning direct upgrade to 2.1.0

25 May 2021, 3:10 AM
#7
gernot avatar

gernot

Zen Follower

Join Date:
Feb 2017
Location:
Tokyo, Japan
Posts:
334
Plugin Contributions:
0

Re: Paypal IPN updates require intervention?

Good news! I just got another log file, this time no error reported. Fix worked, thank you so much @lat9 and DrByte.
ipn_1621909522_jSMo4.log

May 25 2021 11:25 -- IPN PROCESSING INITIATED.
*** Originating IP: 173.0.81.65 notify.paypal.com
*** Browser/User Agent: PayPal IPN ( https://www.paypal.com/ipn )

May 25 2021 11:25 -- Breakpoint: 0 - Initializing debugging.

May 25 2021 11:25 -- Breakpoint: Flag Status:
isECtransaction = 1
isDPtransaction = 0

May 25 2021 11:25 -- IPN INFO - POST VARS received (sorted):
Array
(
[address_city] => <snipped>
[address_country] => Japan
[address_country_code] => JP
[address_name] => <snipped>
[address_state] => <snipped>
[address_status] => confirmed
[address_street] => <snipped>
[address_zip] => <snipped>
[auth_amount] => <snipped>
[auth_exp] => 19:46:42 Jun 19, 2021 PDT
[auth_id] => 1****************
[auth_status] => Completed
/../
[transaction_entity] => payment
[transaction_subject] =>
[txn_id] => 5****************
[txn_type] => cart
[verify_sign] => <snipped>
)

May 25 2021 11:25 -- IPN INFO - POST VARS to be sent back (unsorted) for validation (using CURL):
To: ipnpb.paypal.com:443
Array
(
[cmd] => _notify-validate
[option_selection3_1] =>
[invoice] => **-**********-[ProteaWinesJapan]
[first_name] => <snipped>
/../
[option_name1_1] =>
[memo] => Thank you for your order.
[auth_amount] => <snipped>
[ipn_track_id] => <snipped>
)

May 25 2021 11:25 -- CURL OPTS: Array
(
[10002] => https://ipnpb.paypal.com/cgi-bin/webscr
[47] => 1
[10015] => cmd=_notify-validate&option_selection3_1=&/../&ipn_track_id=<snipped>
[13] => **
[78] => **
[41] =>
[42] =>
[52] =>
[19913] => 1
[75] => 1
[74] => 1
[84] => 2
[10018] => Zen Cart(R) - IPN Postback
)

May 25 2021 11:25 -- CURL response: VERIFIED

May 25 2021 11:25 -- IPN INFO (cl) - Confirmation/Validation response VERIFIED

May 25 2021 11:25 -- Breakpoint: 1 - Collected data from PayPal notification

May 25 2021 11:25 -- Breakpoint: 2 - Validated transaction components

May 25 2021 11:25 -- Breakpoint: 3 - Communication method verified

May 25 2021 11:25 -- IPN NOTICE :: This transaction HAS a parent record. Thus this is an update of some sort.

May 25 2021 11:25 -- Breakpoint: 4 - Details: txn_type=parent ordersID = *** IPN_id=**

Relevant data from POST:
txn_type = parent
parent_txn_id = 1****************
txn_id = 5****************

May 25 2021 11:25 -- Breakpoint: 5 - Transaction type (txn_type) = cleared-authorization [parentLookup=parent]

May 25 2021 11:25 -- IPN NOTICE :: Storing order/update details for order #*** txn_id: 5**************** PP IPN ID: **

May 25 2021 11:25 -- IPN NOTICE :: Added PP status-history record for order #*** txn_id: 5**************** (updated/child) PP IPN ID:

May 25 2021 11:25 -- IPN NOTICE :: Set new status 2 for order ID = **

May 25 2021 11:25 -- IPN NOTICE :: Updating order #*** to status: 2 (txn_type: cleared-authorization)

May 25 2021 11:25 -- IPN NOTICE :: Update complete.

May 25 2021 11:25 -- IPN NOTICE :: Updating order #*** downloads (if any). New max days: 10, New count: 5

Zen Cart 1.5.6c modified for Japanese language support. Upgraded incrementally from initial 1.5.5d. Currently planning direct upgrade to 2.1.0

26 May 2021, 6:41 AM
#8
gernot avatar

gernot

Zen Follower

Join Date:
Feb 2017
Location:
Tokyo, Japan
Posts:
334
Plugin Contributions:
0

Re: Paypal IPN updates require intervention?

Hmm, not sure why but I am still getting a daily error message from Paypal (see initial post).
I did have one more ipn_*.log, but it contained no POST data and said that the exchange looked browser-initiated (when I restored a session maybe) rather than from Paypal.
Nothing in my error logs that I can tell though. I guess I should look at my web server logs next, but I do not have any blocking on HTTP or HTTPS ports.
Any other options I should consider?

Zen Cart 1.5.6c modified for Japanese language support. Upgraded incrementally from initial 1.5.5d. Currently planning direct upgrade to 2.1.0

26 May 2021, 11:51 AM
#9
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,142
Plugin Contributions:
56

Re: Paypal IPN updates require intervention?

gernot:

Hmm, not sure why but I am still getting a daily error message from Paypal (see initial post).
I did have one more ipn_*.log, but it contained no POST data and said that the exchange looked browser-initiated (when I restored a session maybe) rather than from Paypal.
Nothing in my error logs that I can tell though. I guess I should look at my web server logs next, but I do not have any blocking on HTTP or HTTPS ports.
Any other options I should consider?
Since there was a MySQL error created initially, the on-site PayPal processing didn't complete its handshake with PayPal. That's why the PayPal message was originally correct ... there was an issue with the IPN post-back address.

Now that you've added that (int) cast, the IPN sequences will finish successfully and PayPal will note that with each IPN request.