Re: PayPal RESTful API Payment Module
Quote:
Originally Posted by
siliconbug
Zen Cart v1.58a
Paypal RESTful v1.0.2
Payment Action: Auth Only
I disable PayPal Express Checkout and enable Paypal RESTful today.
There are two orders. The 1st order is paid by PayPal Wallet, and the 2nd order is paid by Credit Card.
The 1st payment goes through, but the 2nd order gives me an error:
Both orders get this error when I capture the payments, but I can get correct $$ into my PayPal account:
Something under PayPal Transactions doesn't look right.
Attachment 20651
Should I remove PayPal Express Checkout completely? Or any possible issue I missed?
I disable Credit Card and keep using PayPal Wallet only.
Still get the same error after every order:
Quote:
The payment module's observer (auto.paypalrestful.php) was not loaded; the payment module has been disabled. The payment module has been automatically disabled.
Logs don't show any error, and I can capture $$ without any issue.
/includes/classes/observers/auto.paypalrestful.php is at the right place.
I test it in Sandbox mode, and everything goes well without such an error.
Is there anything I miss?
Re: PayPal RESTful API Payment Module
Turn on the payment module's debug and send the resulting log to me via direct email.
Re: PayPal RESTful API Payment Module
I did a successful PayPal test earlier, worked fine. Now trying it again, using the same account, and the same product, and it gives me a WHITE SCREEN as soon as I click the "Confirm Order" button on the OPC checkout page. It never takes me to the PayPal login page.
Here are the two debug log files.
File: myDEBUG-20240621-191454-655888.log
Code:
[21-Jun-2024 12:14:55 America/Los_Angeles] Request URI: /store/index.php?main_page=checkout_one_confirmation, IP address: 76.127.00.32
--> PHP Fatal error: Uncaught Error: Call to undefined method paypalr::sendAlertMessage() in /home/domain/public_html/store/includes/modules/payment/paypalr.php:953
Stack trace:
#0 /home/domain/public_html/store/includes/classes/payment.php(248): paypalr->pre_confirmation_check()
#1 /home/domain/public_html/store/includes/modules/pages/checkout_one_confirmation/header_php.php(246): payment->pre_confirmation_check()
#2 /home/domain/public_html/store/index.php(35): require('/home/domain/...')
#3 {main}
thrown in /home/domain/public_html/store/includes/modules/payment/paypalr.php on line 953.
File 2: paypalr-c-27905-JefMas-20240621.log (only the bottom part of the log)
Code:
2024-06-21 12:14:55: (checkout_one_confirmation) ==> End createOrder\ConfirmPayPalPaymentChoiceRequest::__construct(...) finished, request:
{
"paypal": {
"name": {
"given_name": "Jeff",
"surname": "Mash"
},
"email_address": "email######################",
"experience_context": {
"payment_method_preference": "IMMEDIATE_PAYMENT_REQUIRED",
"brand_name": "Brand",
"landing_page": "NO_PREFERENCE",
"shipping_preference": "SET_PROVIDED_ADDRESS",
"user_action": "PAY_NOW",
"return_url": "https:\/\/www.domain.com\/store\/ppr_webhook_main.php?op=return",
"cancel_url": "https:\/\/www.domain.com\/store\/ppr_webhook_main.php?op=cancel"
}
}
}
2024-06-21 12:14:55: (checkout_one_confirmation) ==> Start confirmPaymentSource
TokenCache::get, using saved access-token; expires in 31506 seconds.
The curlPost (v2/checkout/orders/0K792404TN0597925/confirm-payment-source) request was unsuccessful.
{
"errNum": 422,
"errMsg": "An interface error (422) was returned from PayPal.",
"curlErrno": 0,
"name": "UNPROCESSABLE_ENTITY",
"message": "The requested action could not be performed, semantically incorrect, or failed business validation.",
"details": [
{
"issue": "ORDER_ALREADY_AUTHORIZED",
"description": "Order already authorized.If 'intent=AUTHORIZE' only one authorization per order is allowed."
}
],
"debug_id": "4997a45158c3b"
}
CURL Options: {
"78": 10,
"52": false,
"75": true,
"74": true,
"42": 0,
"19913": true,
"13": 45,
"47": true,
"10002": "https:\/\/api-m.paypal.com\/v2\/checkout\/orders\/0K792404TN0597925\/confirm-payment-source",
"10015": "{\"payment_source\":{\"paypal\":{\"name\":{\"given_name\":\"Jeff\",\"surname\":\"Mash\"},\"email_address\":\"email######################\",\"experience_context\":{\"payment_method_preference\":\"IMMEDIATE_PAYMENT_REQUIRED\",\"brand_name\":\"MJM Magic\",\"landing_page\":\"NO_PREFERENCE\",\"shipping_preference\":\"SET_PROVIDED_ADDRESS\",\"user_action\":\"PAY_NOW\",\"return_url\":\"https:\\\/\\\/www.domain.com\\\/store\\\/ppr_webhook_main.php?op=return\",\"cancel_url\":\"https:\\\/\\\/www.domain.com\\\/store\\\/ppr_webhook_main.php?op=cancel\"}}}}"
}
2024-06-21 12:14:55: (checkout_one_confirmation) ==> End confirmPaymentSource
Is there some kind of conflict with the old paypaldp and paypalwpp modules which I also have installed? I believe I tried to disable them (not uninstall) but still saw the same issue.
I don't understand why this worked earlier in my test and now it doesn't.
Re: PayPal RESTful API Payment Module
Crud, line 953-956 should read
Code:
$this->sendAlertEmail(
MODULE_PAYMENT_PAYPALR_ALERT_SUBJECT_CONFIRMATION_ERROR,
MODULE_PAYMENT_PAYPALR_ALERT_CONFIRMATION_ERROR . "\n" . Logger::logJSON($payment_choice_response) . "\n" . Logger::logJSON($this->ppr->getErrorInfo())
);
... not sendAlertMessage.
Update: GitHub issue created (https://github.com/lat9/paypalr/issues/26)
Re: PayPal RESTful API Payment Module
Quote:
Originally Posted by
lat9
Crud, line 953-956 should read
Code:
$this->sendAlertEmail(
MODULE_PAYMENT_PAYPALR_ALERT_SUBJECT_CONFIRMATION_ERROR,
MODULE_PAYMENT_PAYPALR_ALERT_CONFIRMATION_ERROR . "\n" . Logger::logJSON($payment_choice_response) . "\n" . Logger::logJSON($this->ppr->getErrorInfo())
);
... not sendAlert
Message.
Update: GitHub issue created (
https://github.com/lat9/paypalr/issues/26)
Glad to help find that! I wonder why it seemed to work to submit my first test order though? Because it did that, I thought perhaps I screwed something up when toggling modules back and forth. :D
Re: PayPal RESTful API Payment Module
Quote:
Originally Posted by
Jeff_Mash
Glad to help find that!
Hey Cindy - I manually changed the name of the function to sendAlertEmail() and tried again. This time, I get an actual error message on the OPC page:
"We are unable to process your PayPal Checkout payment at this time. Please contact us for assistance."
Looking at the debug log file, it seems to indicate that this transaction was previously authorized:
Code:
024-06-21 14:25:37: (checkout_one_confirmation) ==> Start confirmPaymentSource
TokenCache::get, using saved access-token; expires in 32322 seconds.
The curlPost (v2/checkout/orders/0K792404TN0597925/confirm-payment-source) request was unsuccessful.
{
"errNum": 422,
"errMsg": "An interface error (422) was returned from PayPal.",
"curlErrno": 0,
"name": "UNPROCESSABLE_ENTITY",
"message": "The requested action could not be performed, semantically incorrect, or failed business validation.",
"details": [
{
"issue": "ORDER_ALREADY_AUTHORIZED",
"description": "Order already authorized.If 'intent=AUTHORIZE' only one authorization per order is allowed."
}
],
"debug_id": "81bd08dcd3053"
}
CURL Options: {
"78": 10,
"52": false,
"75": true,
"74": true,
"42": 0,
"19913": true,
"13": 45,
"47": true,
"10002": "https:\/\/api-m.paypal.com\/v2\/checkout\/orders\/0K792404TN0597925\/confirm-payment-source",
"10015": "{\"payment_source\":{\"paypal\":{\"name\":{\"given_name\":\"Jeff\",\"surname\":\"Mash\"},\"email_address\":\"email######################\",\"experience_context\":{\"payment_method_preference\":\"IMMEDIATE_PAYMENT_REQUIRED\",\"brand_name\":\"MJM Magic\",\"landing_page\":\"NO_PREFERENCE\",\"shipping_preference\":\"SET_PROVIDED_ADDRESS\",\"user_action\":\"PAY_NOW\",\"return_url\":\"https:\\\/\\\/www.mjmmagic.com\\\/store\\\/ppr_webhook_main.php?op=return\",\"cancel_url\":\"https:\\\/\\\/www.domain.com\\\/store\\\/ppr_webhook_main.php?op=cancel\"}}}}"
}
2024-06-21 14:25:37: (checkout_one_confirmation) ==> End confirmPaymentSourceWe are unable to process your PayPal Checkout payment at this time. Please contact us for assistance.
************************************************
2024-06-21 14:25:38: (checkout_one) validateCredentials: Checking (1).
TokenCache::get, using saved access-token; expires in 32321 seconds.
************************************************
As you can see, it says "Order already authorized.If 'intent=AUTHORIZE' only one authorization per order is allowed."
However, this is a new transaction I am pushing over. Granted, I am using the same user account, same PayPal account, and purchasing the same product. But the original order that successfully submitted has been VOIDED in PayPal. So I don't know why it's still saying "ORDER_ALREADY_AUTHORIZED" since this would be a new order.
Any way to look into that? I can help debug if need be, just let me know or hit me up on Skype.
Re: PayPal RESTful API Payment Module
I'm wondering if what I pointed out above is somehow tied into the AUTH ONLY setting that we enabled? I don't think most people use AUTH ONLY like we do, so maybe it's a bug? Like I said, the first time we placed the order (Paypal Wallet - AUTH ONLY), it submitted. We voided it out, deleted the order, and tried again using the same customer, same PayPal account, same product. Everything about the order was identical. This time, it failed with the message and log that I documented above this post.
Hope that helps to see if we can help you reproduce it, or to help explain why we would have gotten that "ORDER_ALREADY_AUTHORIZED" error when it was a new (second) order we were testing with the same product and same account.
Re: PayPal RESTful API Payment Module
Quote:
Originally Posted by
Jeff_Mash
I'm wondering if what I pointed out above is somehow tied into the AUTH ONLY setting that we enabled?
Hi Jeff_Mash,
Sorry to interrupt your question. Have you met such an error when you receive an auth-only order?
Quote:
The payment module's observer (auto.paypalrestful.php) was not loaded; the payment module has been disabled. The payment module has been automatically disabled.
I also use auth-only, but not sure if it's my problem, or an issue while using auth-only mode.
Re: PayPal RESTful API Payment Module
Quote:
Originally Posted by
siliconbug
Hi Jeff_Mash,
Sorry to interrupt your question. Have you met such an error when you receive an auth-only order?
I also use auth-only, but not sure if it's my problem, or an issue while using auth-only mode.
Check Step 2 in the installation instructions:
Quote:
2. If your site is using a Zen Cart version prior to 2.0.0, add the payment module's required notifications to the order_total class, as described in this Wiki article. Without this update, the payment module will automatically disable itself.
Wiki Link:
https://github.com/lat9/paypalr/wiki...r_total.php%60
That will probably fix your issue.
Here is also a list of other events that could cause the module to disable:
https://github.com/lat9/paypalr/wiki...-notifications
Re: PayPal RESTful API Payment Module
Turns out (thanks @siliconbug for the aid in debugging!) that the auto-disable was due to the PayPal ipn_main_handler.php's operation. That was creating an instance of the paypalr payment module and since the IPN processing doesn't load auto-loaded observers ... paypalr was auto-disabling!
See this GitHub issue for the resolution: https://github.com/lat9/paypalr/issues/27