Re: PayPal RESTful API Payment Module
That's not helpful, I'm looking for a "pattern" for the failure so I need specifics.
Re: PayPal RESTful API Payment Module
My best guess is that, for the sites that are auto-disabling after successfully retrieving the PayPal OAuth token, the required changes to the order_totals.php class were not applied: https://github.com/lat9/paypalr/wiki...r_total.php%60
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.
Code:
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:
Code:
if (SHIPPING_ORIGIN_ZIP !== '') {
$level_3['ships_from_postal_code'] = SHIPPING_ORIGIN_ZIP;
}
to:
Code:
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.
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.
Re: PayPal RESTful API Payment Module
Quote:
Originally Posted by
BillJ
I just installed Paypal Restful 1.01 on our test server and came up against an issue with card processing.
Code:
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:
Code:
if (SHIPPING_ORIGIN_ZIP !== '') {
$level_3['ships_from_postal_code'] = SHIPPING_ORIGIN_ZIP;
}
to:
Code:
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.
Quote:
Originally Posted by
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.
Re: PayPal RESTful API Payment Module
Quote:
Originally Posted by
lat9
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?
Re: PayPal RESTful API Payment Module
Quote:
Originally Posted by
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.
Re: PayPal RESTful API Payment Module
Quote:
Originally Posted by
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.
Re: PayPal RESTful API Payment Module
Re: PayPal RESTful API Payment Module
Will this be part of the ZC 2.0 release?