Forums / PayPal RESTful support / PayPal RESTful API Payment Module

PayPal RESTful API Payment Module

Views: 84,737

Results 61 to 80 of 491
19 Feb 2024, 4:15 PM
#61
lat9 avatar

lat9

Administrator

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

PayPal RESTful API Payment Module

That's not helpful, I'm looking for a "pattern" for the failure so I need specifics.

9 Mar 2024, 3:03 PM
#63
billj avatar

billj

New Zenner

Join Date:
Sep 2013
Location:
Devon, UK
Posts:
88
Plugin Contributions:
1

Re: PayPal RESTful API Payment Module

I just installed Paypal Restful 1.01 on our test server and came up against an issue with card processing.

2024-03-09 14:04:23: (checkout_process) ==> Start createOrder
TokenCache::get, using saved access-token; expires in 32362 seconds.
The curlPost (v2/checkout/orders) request was unsuccessful.
{
    "errNum": 400,
    "errMsg": "",
    "curlErrno": 0,
    "name": "INVALID_REQUEST",
    "message": "Request is not well-formed, syntactically incorrect, or violates schema.",
    "details": [
        {
            "field": "\/purchase_units\/@reference_id=='default'\/supplementary_data\/card\/level3\/ships_from_postal_code",
            "value": "TQ12 5TZ",
            "location": "body",
            "issue": "must match \"^[a-zA-Z0-9_'.-]*$\""
        }
    ],
    "debug_id": "8a641239069c5"
}

...

2024-03-09 14:04:23: (checkout_process) ==> End createOrderAn error occurred when we tried to process your credit card. Please try again, select an alternate payment method or contact us for assistance.

A correctly-formatted UK postcode has a space in it, as above. Paypal appears to have rejected it because it isn't expecting a space. This is not necessarily the fault of the Zen Cart payment module but I managed to get around it by editing includes/modules/payment/paypal/PayPalRestful/Zc2Pp/CreatePayPalOrderRequest.php, changing:

        if (SHIPPING_ORIGIN_ZIP !== '') {
            $level_3['ships_from_postal_code'] = SHIPPING_ORIGIN_ZIP;
        }

to:

        if (SHIPPING_ORIGIN_ZIP !== '') {
            $level_3['ships_from_postal_code'] = str_replace(' ', '', SHIPPING_ORIGIN_ZIP);
        }

at line 466 to remove the space.

After that, the card payment went through fine. It might be worth looking into this further as the workaround might not be the right way to fix it.

9 Mar 2024, 4:19 PM
#64
billj avatar

billj

New Zenner

Join Date:
Sep 2013
Location:
Devon, UK
Posts:
88
Plugin Contributions:
1

Re: PayPal RESTful API Payment Module

I couldn't find anything in the Paypal API docs that specifies the format of the ships_from_postal_code field. Only that it shoudl be 1-60 characters long.

9 Mar 2024, 10:22 PM
#65
lat9 avatar

lat9

Administrator

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

Re: PayPal RESTful API Payment Module

BillJ:

I just installed Paypal Restful 1.01 on our test server and came up against an issue with card processing.

2024-03-09 14:04:23: (checkout_process) ==> Start createOrder
TokenCache::get, using saved access-token; expires in 32362 seconds.
The curlPost (v2/checkout/orders) request was unsuccessful.
{
"errNum": 400,
"errMsg": "",
"curlErrno": 0,
"name": "INVALID_REQUEST",
"message": "Request is not well-formed, syntactically incorrect, or violates schema.",
"details": [
{
"field": "/purchase_units/@reference_id=='default'/supplementary_data/card/level3/ships_from_postal_code",
"value": "TQ12 5TZ",
"location": "body",
"issue": "must match "^[a-zA-Z0-9_'.-]*$""
}
],
"debug_id": "8a641239069c5"
}

...

2024-03-09 14:04:23: (checkout_process) ==> End createOrderAn error occurred when we tried to process your credit card. Please try again, select an alternate payment method or contact us for assistance.

> 
> A correctly-formatted UK postcode has a space in it, as above. Paypal appears to have rejected it because it isn't expecting a space. This is not necessarily the fault of the Zen Cart payment module but I managed to get around it by editing *includes/modules/payment/paypal/PayPalRestful/Zc2Pp/CreatePayPalOrderRequest.php*, changing:
> 
> ```
        if (SHIPPING_ORIGIN_ZIP !== '') {
            $level_3['ships_from_postal_code'] = SHIPPING_ORIGIN_ZIP;
        }

to:

    if (SHIPPING_ORIGIN_ZIP !== '') {
        $level_3['ships_from_postal_code'] = str_replace(' ', '', SHIPPING_ORIGIN_ZIP);
    }
> 
> at line 466 to remove the space.
> 
> After that, the card payment went through fine. It might be worth looking into this further as the workaround might not be the right way to fix it.

> **BillJ:**
>
> I couldn't find anything in the Paypal API docs that specifies the format of the *ships_from_postal_code* field. Only that it shoudl be 1-60 characters long.
Thanks for sussing that out; I've opened a GitHub issue to track the change (<https://github.com/lat9/paypalr/issues/14>) and use your suggested correction.
9 Mar 2024, 11:12 PM
#66
billj avatar

billj

New Zenner

Join Date:
Sep 2013
Location:
Devon, UK
Posts:
88
Plugin Contributions:
1

Re: PayPal RESTful API Payment Module

lat9:

Thanks for sussing that out; I've opened a GitHub issue to track the change (https://github.com/lat9/paypalr/issues/14) and use your suggested correction.
Thanks. Other than that it looks great and I'm going to install it on our production server. Since it replaces Paypal Express, are there any plans to implement the Paypal Express Checkout button?

10 Mar 2024, 2:17 PM
#67
lat9 avatar

lat9

Administrator

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

Re: PayPal RESTful API Payment Module

BillJ:

Thanks. Other than that it looks great and I'm going to install it on our production server. Since it replaces Paypal Express, are there any plans to implement the Paypal Express Checkout button?
I've got no plans for a PayPal Express Checkout button at this time; the best I can offer is that the payment module works with the guest-checkout feature of One-Page Checkout.

10 Mar 2024, 10:43 PM
#68
billj avatar

billj

New Zenner

Join Date:
Sep 2013
Location:
Devon, UK
Posts:
88
Plugin Contributions:
1

Re: PayPal RESTful API Payment Module

lat9:

I've got no plans for a PayPal Express Checkout button at this time; the best I can offer is that the payment module works with the guest-checkout feature of One-Page Checkout.
That's a fair trade. I always thought the Express Checkout button added a lot of complexity to the checkout code.

10 Mar 2024, 11:19 PM
#69
lat9 avatar

lat9

Administrator

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

Re: PayPal RESTful API Payment Module

:thumbsup:

13 Mar 2024, 5:50 PM
#70
webskipper avatar

webskipper

Totally Zenned

Join Date:
Nov 2007
Location:
USA
Posts:
876
Plugin Contributions:
2

Re: PayPal RESTful API Payment Module

Will this be part of the ZC 2.0 release?

Cheers!
v2.2.1

13 Mar 2024, 6:08 PM
#71
lat9 avatar

lat9

Administrator

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

Re: PayPal RESTful API Payment Module

Webskipper:

Will this be part of the ZC 2.0 release?
Nope, it needs to "get its feet wet" before committing to core.

20 Mar 2024, 2:45 PM
#72
simon1066 avatar

simon1066

Totally Zenned

Join Date:
Feb 2009
Location:
UK
Posts:
1,326
Plugin Contributions:
0

Re: PayPal RESTful API Payment Module

ZC 1.5.8a
PHP 8.1.27
PayPal Checkout (RESTful) 1.0.1
OPC 2.4.6
Square WebPay 1.2.0

I get this warning when voiding a transaction

[20-Mar-2024 14:29:00 Europe/London] Request URI: /MY_ADMIN/index.php?cmd=orders&page=1&oID=1391&action=doVoid, IP address: xx.xx.xx.xx, Language id 1
#0 /home/MY_DOMAIN/public_html/includes/modules/payment/paypal/PayPalRestful/Admin/DoVoid.php(92): zen_debug_error_handler()
#1 /home/MY_DOMAIN/public_html/includes/modules/payment/paypalr.php(1912): PayPalRestful\Admin\DoVoid->__construct()
#2 /home/MY_DOMAIN/public_html/MY_ADMIN/orders.php(405): paypalr->_doVoid()
#3 /home/MY_DOMAIN/public_html/MY_ADMIN/index.php(11): require('...')
--> PHP Warning: Undefined variable $last_auth_txn in /home/MY_DOMAIN/public_html/includes/modules/payment/paypal/PayPalRestful/Admin/DoVoid.php on line 92.

[20-Mar-2024 14:29:00 Europe/London] Request URI: /MY_ADMIN/index.php?cmd=orders&page=1&oID=1391&action=doVoid, IP address: xx.xx.xx.xx, Language id 1
#0 /home/MY_DOMAIN/public_html/includes/modules/payment/paypal/PayPalRestful/Admin/DoVoid.php(92): zen_debug_error_handler()
#1 /home/MY_DOMAIN/public_html/includes/modules/payment/paypalr.php(1912): PayPalRestful\Admin\DoVoid->__construct()
#2 /home/MY_DOMAIN/public_html/MY_ADMIN/orders.php(405): paypalr->_doVoid()
#3 /home/MY_DOMAIN/public_html/MY_ADMIN/index.php(11): require('...')
--> PHP Warning: Trying to access array offset on value of type null in /home/MY_DOMAIN/public_html/includes/modules/payment/paypal/PayPalRestful/Admin/DoVoid.php on line 92.

and because of this (I assume) the Trans ID is blank in the admin orders 'voided' comments block


VOIDED. Trans ID: [blank]
Transaction voided.

Simon

22 Mar 2024, 8:35 AM
#75
billj avatar

billj

New Zenner

Join Date:
Sep 2013
Location:
Devon, UK
Posts:
88
Plugin Contributions:
1

Re: PayPal RESTful API Payment Module

I noticed some behaviour yesterday that I didn't expect (and some that I did, for contrast).

Firstly, what I did expect:
A customer tried to place an order and Paypal didn't trust the card. I received an e-mail:
"ALERT: PayPal Checkout Error (Lost/Stolen/Fraudulent Card)" containing some of the card details. No order was created and the customer tried and failed a couple more times before trying a different card and paying successfully. This time the order was created.

Then what I didn't expect:
A different customer tried to place an order and their card was declined for some unspecified reason. I received an e-mail:
"ALERT: PayPal Checkout Error (Order Requires Attention)", "The status for order #23510 was forced to "Pending" due to a PayPal response status of 'DECLINED'"
The order was created and the status set to "Pending" as per the e-mail notification.

When I spoke to the customer to ask for payment via another card (they are a regular business-to-business customer) they weren't aware the payment had failed. However, I cannot say whether that is because they were not notified or just because they didn't notice and that isn't really the issue.
We are not used to seeing an order being created after a failed payment and we have always been able to assume that an order from the web-site is paid for and ready to be shipped, without any further examination of its status. Is this expected behaviour? I suppose it must be since there was a specific e-mail notification for that event.

22 Mar 2024, 8:55 AM
#76
billj avatar

billj

New Zenner

Join Date:
Sep 2013
Location:
Devon, UK
Posts:
88
Plugin Contributions:
1

Re: PayPal RESTful API Payment Module

I forgot to say I'm using ZC 1.58a, OPC 2.4.6 and PP Restful 1.0.1

22 Mar 2024, 11:27 PM
#77
lat9 avatar

lat9

Administrator

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

Re: PayPal RESTful API Payment Module

BillJ:

I noticed some behaviour yesterday that I didn't expect (and some that I did, for contrast).

Firstly, what I did expect:
A customer tried to place an order and Paypal didn't trust the card. I received an e-mail:
"ALERT: PayPal Checkout Error (Lost/Stolen/Fraudulent Card)" containing some of the card details. No order was created and the customer tried and failed a couple more times before trying a different card and paying successfully. This time the order was created.

Then what I didn't expect:
A different customer tried to place an order and their card was declined for some unspecified reason. I received an e-mail:
"ALERT: PayPal Checkout Error (Order Requires Attention)", "The status for order #23510 was forced to "Pending" due to a PayPal response status of 'DECLINED'"
The order was created and the status set to "Pending" as per the e-mail notification.

When I spoke to the customer to ask for payment via another card (they are a regular business-to-business customer) they weren't aware the payment had failed. However, I cannot say whether that is because they were not notified or just because they didn't notice and that isn't really the issue.
We are not used to seeing an order being created after a failed payment and we have always been able to assume that an order from the web-site is paid for and ready to be shipped, without any further examination of its status. Is this expected behaviour? I suppose it must be since there was a specific e-mail notification for that event.
Are you running paypalr in Auth-Only or Final-Payment mode? Do you know if there was an SCA path taken when the payment was processed?

I'll note that what you describe as unexpected ***is ***unexpected!

23 Mar 2024, 9:47 AM
#78
billj avatar

billj

New Zenner

Join Date:
Sep 2013
Location:
Devon, UK
Posts:
88
Plugin Contributions:
1

Re: PayPal RESTful API Payment Module

Thank you.

lat9:

Are you running paypalr in Auth-Only or Final-Payment mode?
I have Payment Action set to "Final Sale" in the paypalr configuration, if that's the setting you mean.

lat9:

Do you know if there was an SCA path taken when the payment was processed?
I don't know, sorry. Would it be logged somewhere by paypalr? I have debugging switched on. There was a Paypal transaction number stored in Zen Cart but it was not recognised when I searched for it in our Paypal account.
The card the customer used was not their usual card that we keep on file for telephone orders and they don't often order online anyway so it might have triggered SCA. However that is just speculation.

23 Mar 2024, 12:07 PM
#79
lat9 avatar

lat9

Administrator

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

Re: PayPal RESTful API Payment Module

BillJ:

Thank you.

I have Payment Action set to "Final Sale" in the paypalr configuration, if that's the setting you mean.

I don't know, sorry. Would it be logged somewhere by paypalr? I have debugging switched on. There was a Paypal transaction number stored in Zen Cart but it was not recognised when I searched for it in our Paypal account.
The card the customer used was not their usual card that we keep on file for telephone orders and they don't often order online anyway so it might have triggered SCA. However that is just speculation.
If debugging was switched on when the errant transaction was run, there will be a paypalr-c-{cid}-ffflll-yyyymmdd.log present. {cid} is the customer's ID and {ffflll} is the first 3 characters of the customer's first/last name. If you find such a log, send me a PM and I'll send back my direct email address.

23 Mar 2024, 5:44 PM
#80
billj avatar

billj

New Zenner

Join Date:
Sep 2013
Location:
Devon, UK
Posts:
88
Plugin Contributions:
1

Re: PayPal RESTful API Payment Module

lat9:

If debugging was switched on when the errant transaction was run, there will be a paypalr-c-{cid}-ffflll-yyyymmdd.log present. {cid} is the customer's ID and {ffflll} is the first 3 characters of the customer's first/last name. If you find such a log, send me a PM and I'll send back my direct email address.
Thank you. Log on its way.
I can see from the log that the card failed the CVV check. The customer probably mis-typed it. Despite having an account, they had checked out as a guest using OPC.