Forums / PayPal RESTful support / PayPal RESTful API Payment Module

PayPal RESTful API Payment Module

Views: 84,737

Results 1 to 20 of 491
12 Jan 2024, 1:16 PM
#1
lat9 avatar

lat9

Administrator

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

PayPal RESTful API Payment Module

This Zen Cart payment module (paypalr) combines the processing for the PayPal Payments Pro (paypaldp) and PayPal Express Checkout (paypalwpp) payment modules that are currently built into Zen Cart distributions. Instead of using the older NVP (Name Value Pair) methods to communicate with PayPal, this payment module uses PayPal's now-current REST APIs and combines the two legacy methods into one.

Zen Cart Support Thread: https://www.zen-cart.com/forumdisplay.php?170-PayPal-RESTful-support

Zen Cart Plugin Download Link: https://www.zen-cart.com/downloads.php?do=file&id=2382

The module's operation has been validated …

  1. With PHP versions 7.4 through 8.3; PHP 7.3 will result in fatal PHP errors!
  2. In Zen Cart's 3-page checkout environment (v1.5.8a and v2.0.0)
  3. With One-Page Checkout (OPC), v2.4.6
  4. Using OPC's guest-checkout feature.
  5. Both requiring confirmation and not!
  6. With both the built-in responsive_classic and ZCA Bootstrap (v3.6.1) templates.

For additional information, refer to the payment-module's wiki articles.

12 Jan 2024, 1:19 PM
#2
lat9 avatar

lat9

Administrator

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

Re: PayPal RESTful API Payment Module

:beta:Please note: The current release (v1.0.0-beta4) is a **beta **version! While I've tested it extensively, I suggest giving it a try on your test site using a PayPal sandbox account first.

12 Jan 2024, 6:18 PM
#3
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,720
Plugin Contributions:
56

Re: PayPal RESTful API Payment Module

That Software Guy. My Store: Zen Cart Support
Available for hire - See my ad in Services
Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
Do you benefit from Zen Cart? Then please support the project.

12 Jan 2024, 6:20 PM
#4
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,720
Plugin Contributions:
56

Re: PayPal RESTful API Payment Module

Credit to @lat9 for undertaking this labor of love.

Updated integrations with UPS, FedEx, USPS and now PayPal will give Zen Cart - and your stores - a new lease on life.

That Software Guy. My Store: Zen Cart Support
Available for hire - See my ad in Services
Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
Do you benefit from Zen Cart? Then please support the project.

15 Jan 2024, 1:44 PM
#5
mprough avatar

mprough

Totally Zenned

Join Date:
Nov 2007
Location:
Woodbine, Georgia, United States
Posts:
4,297
Plugin Contributions:
39

Re: PayPal RESTful API Payment Module

Zen Cart 1.5.8
Bootstrap 3.5.0
OPC 2.4.5
PHP 7.4.33

Payment modules installed: freecharger, moneyorder & paypalr
Order total modules installed: ot_shipping, ot_coupon, ot_subtotal, ot_tax & ot_subtotal
Shipping modules installed: freeshipper & usps

Other modules installed: RCS, Sales Report w/ Graphs & IH5.

Guest checkout, first test after configuration, clicked PayPal button... no checkbox/radio button seems very confusing with the express button on the checkout/payment page. The button is clickable, but goes no where.

Attachment 20448

So I click it, then confirm order and it fails to the following page & error.

Page Not Found
https://domain.com/cart/ppr_webhook_main.php?op=return&token=576210752B973622B&PayerID=B8KWPQT6BCWP8

The logs looks very much like it completed its work... last few lines

2024-01-15 13:36:02: (checkout_one_confirmation) ==> End confirmPaymentSource
2024-01-15 13:36:02: (checkout_one_confirmation) pre_confirmation_check, sending the payer-action off to PayPal.

15 Jan 2024, 2:46 PM
#6
lat9 avatar

lat9

Administrator

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

Re: PayPal RESTful API Payment Module

You missed the root-directory file ppr_webhook_main.php; that's where the 404 came from. Zen Cart 1.5.8 or 1.5.8a?

15 Jan 2024, 3:37 PM
#7
mprough avatar

mprough

Totally Zenned

Join Date:
Nov 2007
Location:
Woodbine, Georgia, United States
Posts:
4,297
Plugin Contributions:
39

Re: PayPal RESTful API Payment Module

lat9:

You missed the root-directory file ppr_webhook_main.php; that's where the 404 came from. Zen Cart 1.5.8 or 1.5.8a?

1.5.8

Sure did miss, thank a bunch!

~Melanie

15 Jan 2024, 3:39 PM
#8
mprough avatar

mprough

Totally Zenned

Join Date:
Nov 2007
Location:
Woodbine, Georgia, United States
Posts:
4,297
Plugin Contributions:
39

Re: PayPal RESTful API Payment Module

There is still no radio/checkbox for the payment module. Noting it is the only payment displaying.

~Melanie

15 Jan 2024, 5:56 PM
#9
lat9 avatar

lat9

Administrator

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

Re: PayPal RESTful API Payment Module

mprough:

1.5.8

Sure did miss, thank a bunch!

~Melanie
Please note that I've only tested with zc158a and the current zc200-alpha. I won't be supporting any other Zen Cart base for the usage.

mprough:

There is still no radio/checkbox for the payment module. Noting it is the only payment displaying.

~Melanie
There is no radio/checkbox for the module since you've only got that one payment module installed. I'll rethink the means of identifying which (PayPal vs CC) sub-option is selected, but IMO using a radio/checkbox for the sub-option is ugly.

15 Jan 2024, 7:11 PM
#10
mprough avatar

mprough

Totally Zenned

Join Date:
Nov 2007
Location:
Woodbine, Georgia, United States
Posts:
4,297
Plugin Contributions:
39

Re: PayPal RESTful API Payment Module

lat9:

There is no radio/checkbox for the module since you've only got that one payment module installed. I'll rethink the means of identifying which (PayPal vs CC) sub-option is selected, but IMO using a radio/checkbox for the sub-option is ugly.

Maybe a selected state behavior, like a border? and the credit card one doesn't look at all like a selectable option, would need "buttonized" or something

16 Jan 2024, 3:40 PM
#11
lat9 avatar

lat9

Administrator

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

Re: PayPal RESTful API Payment Module

I've just created a GitHub PR with some UI improvements (https://github.com/lat9/paypalr/pull/3), if you'd like to see before the next beta release.

16 Jan 2024, 10:26 PM
#12
mprough avatar

mprough

Totally Zenned

Join Date:
Nov 2007
Location:
Woodbine, Georgia, United States
Posts:
4,297
Plugin Contributions:
39

Re: PayPal RESTful API Payment Module

Another website, different issue.

Zen Cart 1.5.8a
Bootstrap 3.5.2
PHP 7.4.33

On step 2 of 3 Payment Information we got the following error on an order.
Attachment 20450

No log was generated and my next test order went through.

It looks like part of the argument passed has a string too long.

~Melanie

16 Jan 2024, 11:38 PM
#13
lat9 avatar

lat9

Administrator

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

Re: PayPal RESTful API Payment Module

mprough:

Another website, different issue.

Zen Cart 1.5.8a
Bootstrap 3.5.2
PHP 7.4.33

On step 2 of 3 Payment Information we got the following error on an order.
Attachment 20450

No log was generated and my next test order went through.

It looks like part of the argument passed has a string too long.

~Melanie
For the beta phase, you should be running with the payment module's logs enabled; otherwise, I've got no breadcrumbs with which to diagnose the issue.

For that order, what do the ordered products "look like"?

17 Jan 2024, 10:10 AM
#14
mprough avatar

mprough

Totally Zenned

Join Date:
Nov 2007
Location:
Woodbine, Georgia, United States
Posts:
4,297
Plugin Contributions:
39

Re: PayPal RESTful API Payment Module

lat9:

For the beta phase, you should be running with the payment module's logs enabled; otherwise, I've got no breadcrumbs with which to diagnose the issue.

For that order, what do the ordered products "look like"?

I am PM'ing you the log, I rebuilt the customer's basket & retried the transaction. The order is all downloads.

Let me know if you need anything else.

~Melanie

17 Jan 2024, 2:35 PM
#15
lat9 avatar

lat9

Administrator

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

Re: PayPal RESTful API Payment Module

mprough:

I am PM'ing you the log, I rebuilt the customer's basket & retried the transaction. The order is all downloads.

Let me know if you need anything else.

~Melanie
Thanks for that. I'll review the base code to see what's up. The order "should be" marked as virtual.

Update: Replicated.

17 Jan 2024, 4:10 PM
#16
lat9 avatar

lat9

Administrator

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

Re: PayPal RESTful API Payment Module

lat9:

Thanks for that. I'll review the base code to see what's up. The order "should be" marked as virtual.

Update: Replicated.
Now corrected on the module's GitHub repo; see this commit for details: https://github.com/lat9/paypalr/commit/19a9e37b90279118d4d959540125797ecfc4880b

Thanks @mprough for the validation help, I really appreciate it!

24 Jan 2024, 11:50 AM
#18
mprough avatar

mprough

Totally Zenned

Join Date:
Nov 2007
Location:
Woodbine, Georgia, United States
Posts:
4,297
Plugin Contributions:
39

Re: PayPal RESTful API Payment Module

Zen Cart 1.5.8a; bootstrap 3.5.2; PHP 7.4.33

Upon trying a test checkout I get the following error... any idea what this error means?

2024-01-24 11:47:08: (index) ppr_webhook_main (return) starts.
{
"op": "return",
"token": "01L48731GX020100F",
"PayerID": "B8KWPQT6BCWP8",
"main_page": "index"
}
2024-01-24 11:47:08: (index) ==> Start getOrderStatus
TokenCache::get, using saved access-token.The curlGet (v2/checkout/orders/01L48731GX020100F) request was unsuccessful.
{
"errNum": 403,
"errMsg": "",
"curlErrno": 0,
"name": "NOT_AUTHORIZED",
"message": "Authorization failed due to insufficient permissions.",
"details": [
{
"issue": "PERMISSION_DENIED",
"description": "You do not have permission to access or perform operations on this resource."
}
]
}
CURL Options: {
"78": 10,
"52": false,
"75": true,
"74": true,
"42": 0,
"19913": true,
"13": 45,
"80": true,
"10002": "https://api-m.paypal.com/v2/checkout/orders/01L48731GX020100F"
}
2024-01-24 11:47:08: (index) ==> End getOrderStatus
2024-01-24 11:47:08: (index) ==> getOrderStatus failed, redirecting to shopping-cart


~Melanie

24 Jan 2024, 1:53 PM
#19
lat9 avatar

lat9

Administrator

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

Re: PayPal RESTful API Payment Module

@mprough, it's obviously some kind of permissions issue, but the log that you posted doesn't tell the full story. If the webhook's involved, then either the customer paid via paypal and was coming back to confirm and pay or the customer paid via credit card and was sent down a 3DS path for card validation.

24 Jan 2024, 2:45 PM
#20
mprough avatar

mprough

Totally Zenned

Join Date:
Nov 2007
Location:
Woodbine, Georgia, United States
Posts:
4,297
Plugin Contributions:
39

Re: PayPal RESTful API Payment Module

lat9:

@mprough, it's obviously some kind of permissions issue, but the log that you posted doesn't tell the full story. If the webhook's involved, then either the customer paid via paypal and was coming back to confirm and pay or the customer paid via credit card and was sent down a 3DS path for card validation.

I PM'd you the full log. It was my test transaction, regular PayPal was selected. Restful was the only payment module installed. I hit the confirm button, did the paypal login, clicked the pay button on paypal, was returned to the website shopping cart page. The item in my cart was retained, no order was created and I was still logged in.

Hope this helps =)

~Melanie