Forums / PayPal RESTful support / PayPal RESTful API Payment Module

PayPal RESTful API Payment Module

Views: 84,746

Results 341 to 360 of 491
6 Oct 2025, 9:49 AM
#341
lat9 avatar

lat9

Administrator

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

PayPal RESTful API Payment Module

Further inspection of the way that PayPal wants the phone number to be submitted (country-code separated from phone number) makes it "not that easy" to submit phone numbers ... especially since an improperly-formatted one will result in PayPal's rejection of a to-be-placed order.

8 Oct 2025, 4:40 AM
#342
pilou2 avatar

pilou2

Zen Follower

Join Date:
Jun 2008
Location:
Japan
Posts:
400
Plugin Contributions:
6

Re: PayPal RESTful API Payment Module

Did anybody notice that when PayPal Restfull payment module is installed, the payment module page becomes sluggish?
Normally, when selecting a new line by clicking on it, it takes like half a second, but when PayPal module is installed (sandbox mode on a test cart, last git version) it takes between 2 or 3 seconds!
Uninstalling the module will makes things goback to normal.

ZC v2.2.2 PHP 8.4+ MySQL 8.4+

8 Oct 2025, 5:54 AM
#343
pilou2 avatar

pilou2

Zen Follower

Join Date:
Jun 2008
Location:
Japan
Posts:
400
Plugin Contributions:
6

Re: PayPal RESTful API Payment Module

Forgot to say that I used PayPal RESTful v1.2.1.

ZC v2.2.2 PHP 8.4+ MySQL 8.4+

8 Oct 2025, 12:51 PM
#344
lat9 avatar

lat9

Administrator

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

Re: PayPal RESTful API Payment Module

pilou2:

Forgot to say that I used PayPal RESTful v1.2.1.

pilou2:

Did anybody notice that when PayPal Restfull payment module is installed, the payment module page becomes sluggish?
Normally, when selecting a new line by clicking on it, it takes like half a second, but when PayPal module is installed (sandbox mode on a test cart, last git version) it takes between 2 or 3 seconds!
Uninstalling the module will makes things goback to normal.
What other payment modules are enabled?

8 Oct 2025, 2:24 PM
#345
pilou2 avatar

pilou2

Zen Follower

Join Date:
Jun 2008
Location:
Japan
Posts:
400
Plugin Contributions:
6

Re: PayPal RESTful API Payment Module

lat9:

What other payment modules are enabled?

Freecharger.
I uninstalled it but nothing change, I know have PayPalRESTful only.
Does the module try to communicate with a particular PayPal server each time the page is reloaded?

ZC v2.2.2 PHP 8.4+ MySQL 8.4+

8 Oct 2025, 5:22 PM
#346
lat9 avatar

lat9

Administrator

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

Re: PayPal RESTful API Payment Module

pilou2:

Freecharger.
I uninstalled it but nothing change, I know have PayPalRESTful only.
Does the module try to communicate with a particular PayPal server each time the page is reloaded?
If you're adding PayPal/RESTful to a site that previously has only non-API-using payment methods, then you'll see a delay in the page-load since paypalr communicates with the PayPal server to make sure that it's got a valid order to be processed.

8 Oct 2025, 6:49 PM
#347
pilou2 avatar

pilou2

Zen Follower

Join Date:
Jun 2008
Location:
Japan
Posts:
400
Plugin Contributions:
6

Re: PayPal RESTful API Payment Module

I am speaking of admin modules page for payment, not on catalog side cart. Just clicking on another module line (installed or not) to select it and I have to wait 2-3s before the new line/module is actualy selected and this only when PayPalr is installed!
It seems some access to distant server is done on each new line selection (page refresh) which is not normal. There is nothing to process and a server response over 2 seconds is too much especially if its with PayPal network that should be fast.
There might be two problems here:
1 - When just selecting other modules, PayPalr module should not have to communicate with PayPal network.
2 - If PayPalr module communicates with PayPal network it should be with a local (country, Japan in my case) server (mirror?), not with a distant (US?) server.

Or it might be something completly different... I actually have no idea.

ZC v2.2.2 PHP 8.4+ MySQL 8.4+

8 Oct 2025, 8:40 PM
#348
lat9 avatar

lat9

Administrator

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

Re: PayPal RESTful API Payment Module

pilou2:

I am speaking of admin modules page for payment, not on catalog side cart. Just clicking on another module line (installed or not) to select it and I have to wait 2-3s before the new line/module is actualy selected and this only when PayPalr is installed!
It seems some access to distant server is done on each new line selection (page refresh) which is not normal. There is nothing to process and a server response over 2 seconds is too much especially if its with PayPal network that should be fast.
There might be two problems here:
1 - When just selecting other modules, PayPalr module should not have to communicate with PayPal network.
2 - If PayPalr module communicates with PayPal network it should be with a local (country, Japan in my case) server (mirror?), not with a distant (US?) server.

Or it might be something completly different... I actually have no idea.
During the admin's Modules processing, the paypalr payment module verifies that any PayPal credentials entered are valid and auto-disables itself if not.

9 Oct 2025, 3:40 AM
#349
pilou2 avatar

pilou2

Zen Follower

Join Date:
Jun 2008
Location:
Japan
Posts:
400
Plugin Contributions:
6

Re: PayPal RESTful API Payment Module

lat9:

During the admin's Modules processing, the paypalr payment module verifies that any PayPal credentials entered are valid and auto-disables itself if not.

That's it! When setting or testing other modules for me maybe it is better to set PayPalr enable option to false? On a live site it should not be too much of a problem as you don't go there very often.
When I was counting 1 2 3 after each click before clicking on something else, it felt like ZC wanted to waltz!
1 2 3 click ... 1 2 3 click ... 1 2 3 clcik ... click, oh sh...t never been good at dansing...

ZC v2.2.2 PHP 8.4+ MySQL 8.4+

11 Oct 2025, 5:38 AM
#350
pilou2 avatar

pilou2

Zen Follower

Join Date:
Jun 2008
Location:
Japan
Posts:
400
Plugin Contributions:
6

Re: PayPal RESTful API Payment Module

I did some quick fix so that PayPalr module does not do its checking every time you want to do some setting on other modules.
But I think a more efficient approach would be to do the API checking only when PayPalr module is installed or one of its settings is modified, and at most when it is selected. More than that and it is useless and just add a time penalty on all your other actions. Two or three modules doing this could render the admin modules page nearly unusable.
Here is the code I changed in ```
includes/modules/payment/paypalr.php

```php
        $this->enabled = ($this->enabled === true && $this->validateConfiguration($curl_installed));
        if ($this->enabled && IS_ADMIN_FLAG === true) {
            // register/update known webhooks
            $this->ppr->registerAndUpdateSubscribedWebhooks();
        }

to this:

        if (IS_ADMIN_FLAG === false || ($this->enabled === true && $_GET['module'] === 'paypalr')) {
            $this->enabled = ($this->enabled === true && $this->validateConfiguration($curl_installed));
            if ($this->enabled && IS_ADMIN_FLAG === true) {
                // register/update known webhooks
                $this->ppr->registerAndUpdateSubscribedWebhooks();
            }
        }

This just a quick fix for those who might have the same problem.

ZC v2.2.2 PHP 8.4+ MySQL 8.4+

14 Oct 2025, 9:31 AM
#351
pilou2 avatar

pilou2

Zen Follower

Join Date:
Jun 2008
Location:
Japan
Posts:
400
Plugin Contributions:
6

Re: PayPal RESTful API Payment Module

pilou2:

I did some quick fix so that PayPalr module does not do its checking every time you want to do some setting on other modules.
But I think a more efficient approach would be to do the API checking only when PayPalr module is installed or one of its settings is modified, and at most when it is selected. More than that and it is useless and just add a time penalty on all your other actions. Two or three modules doing this could render the admin modules page nearly unusable.
Here is the code I changed in ```
includes/modules/payment/paypalr.php

> ```php
        $this->enabled = ($this->enabled === true && $this->validateConfiguration($curl_installed));
        if ($this->enabled && IS_ADMIN_FLAG === true) {
            // register/update known webhooks
            $this->ppr->registerAndUpdateSubscribedWebhooks();
        }

to this:

    if (IS_ADMIN_FLAG === false || ($this->enabled === true && $_GET['module'] === 'paypalr')) {
        $this->enabled = ($this->enabled === true && $this->validateConfiguration($curl_installed));
        if ($this->enabled && IS_ADMIN_FLAG === true) {
            // register/update known webhooks
            $this->ppr->registerAndUpdateSubscribedWebhooks();
        }
    }
> This just a quick fix for those who might have the same problem.

Forgot about this code, although it works when in admin module page, it will crash when editing an order that uses PayPal RESTful.
It seems that API initialization is taking time, validation is done at the same time but does not change much about delay...
I am adraid I am out of option.
Do you think it is possible to limit API connection to only when the module is actually used?

ZC v2.2.2 PHP 8.4+ MySQL 8.4+

15 Oct 2025, 5:49 PM
#352
lat9 avatar

lat9

Administrator

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

Re: PayPal RESTful API Payment Module

v1.3.0 of the PayPal/RESTful payment module is now available for download: https://www.zen-cart.com/downloads.php?do=file&id=2382

This release contains changes associated with these GitHub issues:

#100: Account for sites where allow_url_fopen is set to false.
#90: curl_close is deprecated in PHP 8.5
#89: Webhook accesses unconditionally create logs
#88: webhook auto-loader, PHP Fatal errors on ZC versions prior to 2.1.0
#86: Provide polyfills and extra-functions to enable additional PHP/ZenCart versions to be supported
#81: Warning messages caused by conflict with messageStack
#76: Integrate PayPal's PayLater Messaging via PayPal JS SDK

19 Oct 2025, 7:53 AM
#353
brittainmark avatar

brittainmark

Totally Zenned

Join Date:
Apr 2009
Posts:
509
Plugin Contributions:
1

Re: PayPal RESTful API Payment Module

Paypal restful 1.3 pay in 4/3. I have installed this on my test site in the uk the messaging for delayed payment is saying pay in 4 and displaying prices in usd not gbp. When i go through checkout to paypal to pay the messaging corrects to GBP and pay in 3.

I don't know if this is me. The paypal js call has US not GB or UK for the javascript.

<script title="PayPalSDK" id="PayPalJSSDK" src="https://www.paypal.com/sdk/js?client-id=sb&debug=true&[B]buyer-country=US&locale=en_US[/B]&components=messages&integration-date=2025-08-01" data-page-type="cart" data-partner-attribution-id="ZenCart_SP_PPCP" data-namespace="PayPalSDK" defer="" data-uid-auto="uid_dhsiskdlptoqptaugsfxcqoceqicfv"></script>

Mark Brittain
http:\innerlightcrystals.co.uk\sales\

19 Oct 2025, 8:09 AM
#354
brittainmark avatar

brittainmark

Totally Zenned

Join Date:
Apr 2009
Posts:
509
Plugin Contributions:
1

Re: PayPal RESTful API Payment Module

Additional. have just checked all the location. The checkout is the only location where the js call looks ok but the message is not displayed.
full list of js calls
shopping cart

<script title="PayPalSDK" id="PayPalJSSDK" src="https://www.paypal.com/sdk/js?client-id=sb&debug=true&buyer-country=US&locale=en_US&components=messages&integration-date=2025-08-01" data-page-type="cart" data-partner-attribution-id="ZenCart_SP_PPCP" data-namespace="PayPalSDK" defer></script>

product page

<script title="PayPalSDK" id="PayPalJSSDK" src="https://www.paypal.com/sdk/js?client-id=sb&debug=true&buyer-country=US&locale=en_US&components=messages&integration-date=2025-08-01" data-page-type="product-details" data-partner-attribution-id="ZenCart_SP_PPCP" data-namespace="PayPalSDK" defer></script>

produt list

<script title="PayPalSDK" id="PayPalJSSDK" src="https://www.paypal.com/sdk/js?client-id=sb&debug=true&buyer-country=US&locale=en_US&components=messages&integration-date=2025-08-01" data-page-type="product-listing" data-partner-attribution-id="ZenCart_SP_PPCP" data-namespace="PayPalSDK" defer></script>

checkout

<script title="PayPalSDK" id="PayPalJSSDK" src="https://www.paypal.com/sdk/js?client-id=sb&debug=true&buyer-country=GB&locale=en_US&currency=GBP&components=messages&integration-date=2025-08-01" data-page-type="checkout" data-partner-attribution-id="ZenCart_SP_PPCP" data-namespace="PayPalSDK" defer></script>

Mark Brittain
http:\innerlightcrystals.co.uk\sales\

19 Oct 2025, 8:58 AM
#355
brittainmark avatar

brittainmark

Totally Zenned

Join Date:
Apr 2009
Posts:
509
Plugin Contributions:
1

Re: PayPal RESTful API Payment Module

More info. I am using sandbox and i see that it defaults to US if there is noting in the cart. If i put something in the cart then it is changes to GB but still displaying $ usd. This appears to be because $order->info['currency'] is null
if i change auto.paypalrestful.php to have line 283 ```
$js_fields['currency'] = DEFAULT_CURRENCY;


if i don't set the currency and set
    $paypalSandboxBuyerCountryCodeOverride = 'GB';
    $paypalSandboxLocaleOverride = 'en_GB';
still get messages in usd and pay in 4.

Mark Brittain
http:\innerlightcrystals.co.uk\sales\

19 Oct 2025, 9:27 AM
#356
brittainmark avatar

brittainmark

Totally Zenned

Join Date:
Apr 2009
Posts:
509
Plugin Contributions:
1

Re: PayPal RESTful API Payment Module

Ok i have got it working!!
If i remove (comment out) the line

$js_fields['client-id'] = 'sb'; // 'sb' for sandbox

and use my sandbox id it works in all locations.

Mark Brittain
http:\innerlightcrystals.co.uk\sales\

20 Oct 2025, 7:54 PM
#357
drbyte avatar

drbyte

Sensei

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

Re: PayPal RESTful API Payment Module

brittainmark:

Ok i have got it working!!
If i remove (comment out) the line

$js_fields['client-id'] = 'sb'; // 'sb' for sandbox

> and use my sandbox id it works in all locations.
As you pointed out, the situation you describe would only happen in sandbox, where those settings are providing some overrides merely for testing/simulation/development purposes.

.
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.

21 Oct 2025, 8:13 AM
#358
brittainmark avatar

brittainmark

Totally Zenned

Join Date:
Apr 2009
Posts:
509
Plugin Contributions:
1

Re: PayPal RESTful API Payment Module

minor issue with old method. does not display messaging because it does not know header sent
change function updateNotifyHtmlHeadEnd in includes/classes/observers/auto.paypalrestful.php lines 125-132to

public function updateNotifyHtmlHeadEnd(&$class, $eventID, $current_page_base)
    {
        // This is a fallback for older versions, to ensure we only output the header JS once.
        if ($this->headerAssetsSent) {
            return;
        }
        $this->headerAssetsSent = $this->outputJsSdkHeaderAssets($current_page_base);
    }

will submit pr.

Mark Brittain
http:\innerlightcrystals.co.uk\sales\

22 Oct 2025, 8:28 AM
#359
tamya avatar

tamya

Zen Follower

Join Date:
Feb 2007
Posts:
336
Plugin Contributions:
0

Re: PayPal RESTful API Payment Module

I downloaded paypalr-1.3.0
I unzipped it to have it installed on my site v2.1.0 on PHP Version: 8.0.30

I know the Admin folder need to be changed to match the admin folder on my site, however,
there is another Admin folder in the installation
C:\Users\pc\Downloads\paypalr-1.3.0\paypalr-1.3.0\includes\modules\payment\paypal\PayPalRestful**Admin
**Do i need to change that also? just making sure doing right the first time. Thanks.

22 Oct 2025, 12:25 PM
#360
lat9 avatar

lat9

Administrator

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

Re: PayPal RESTful API Payment Module

TamyA:

I downloaded paypalr-1.3.0
I unzipped it to have it installed on my site v2.1.0 on PHP Version: 8.0.30

I know the Admin folder need to be changed to match the admin folder on my site, however,
there is another Admin folder in the installation
C:\Users\pc\Downloads\paypalr-1.3.0\paypalr-1.3.0\includes\modules\payment\paypal\PayPalRestful**Admin
**Do i need to change that also? just making sure doing right the first time. Thanks.
You don't need (or want) to change that Admin folder name ... "bad" things would result.