Author Topic: PayPal API updates and fixes  (Read 20493 times)

zanardi

  • Contributing Developer
  • Full Member
  • *
  • Posts: 878
    • GiBiLogic
PayPal API updates and fixes
« on: February 19, 2011, 12:50:22 pm »
Most of PayPal API issues come from some confusing configuration parameters, and on top of that there ARE still some bugs in the code. Mainly they are NOT bugs in payment method class, but in the way ps_checkout should handle this "special" payment method.

I attach to this post a ps_checkout file which SHOULD fix some of the issues regarding checkout steps.

PLEASE NOTE IT IS A WORK IN PROGRESS, NOT RECCOMENDED FOR PRODUCTION ENVIRONMENT.

AND PLEASE NOT IT IS ONLY INTENDED FOR VIRTUEMART 1.1.7

I would be glad if someone can test it, and let me know what's still wrong. Be prepared to explain to me in detail, because up until now i had never had many opportunities to use this payment method.

[attachment cleanup by admin]
--
Francesco (zanardi)
http://extensions.gibilogic.com
@gibilogic on Twitter

CrowdOfOne

  • Beginner
  • *
  • Posts: 11
Re: PayPal API updates and fixes
« Reply #1 on: February 21, 2011, 05:56:08 am »
I don't know anything about paypal's API but would be happy to try it, or am i not exactly your target audience here?

What sort of difference should we expect over the standard ps_checkout from 1.1.7?

EDIT: Disregard this. I've realised i'm using the standard Paypal payment method, not the API version currently. Does look like something I'd like to check out in future tho.

patrickmark

  • Beginner
  • *
  • Posts: 3
Re: PayPal API updates and fixes
« Reply #2 on: February 25, 2011, 04:02:05 am »

I try use paypal api payment method, quick checkout from it works fine, but direct one display this after inserting correct card details:

Error: Error - Paypal did not complete the transaction. Please try again in a little while.
Error: Failure in Processing the Payment (ps_paypal_api)

When i turn in php to display errors on top of that i get:


Deprecated: Function ereg_replace() is deprecated in /home/digital4/public_html/administrator/components/com_virtuemart/classes/ps_checkout.php on line 491

Notice: Undefined index: ppex_token in /home/digital4/public_html/administrator/components/com_virtuemart/classes/payment/ps_paypal_api.php on line 345

Notice: Undefined index: ppex_userdata in /home/digital4/public_html/administrator/components/com_virtuemart/classes/payment/ps_paypal_api.php on line 347


All API part is set-up correctly and I read so many post now and any of them was helpfully.

Please hellp me ...

zanardi

  • Contributing Developer
  • Full Member
  • *
  • Posts: 878
    • GiBiLogic
Re: PayPal API updates and fixes
« Reply #3 on: February 25, 2011, 18:29:28 pm »
@patrickmark:
please DO NOT TRIPLE POSTING! I already read your message in TWO OTHER different threads! This is useless and annoying. The same people usually read different topics.
--
Francesco (zanardi)
http://extensions.gibilogic.com
@gibilogic on Twitter

EdgeCrafter

  • Beginner
  • *
  • Posts: 21
    • EdgeCrafter
  • VirtueMart Version: VM 3.2.1
Re: PayPal API updates and fixes
« Reply #4 on: March 01, 2011, 18:02:53 pm »
Most of PayPal API issues come from some confusing configuration parameters, and on top of that there ARE still some bugs in the code. Mainly they are NOT bugs in payment method class, but in the way ps_checkout should handle this "special" payment method.

I attach to this post a ps_checkout file which SHOULD fix some of the issues regarding checkout steps.

PLEASE NOTE IT IS A WORK IN PROGRESS, NOT RECCOMENDED FOR PRODUCTION ENVIRONMENT.

AND PLEASE NOT IT IS ONLY INTENDED FOR VIRTUEMART 1.1.7

I would be glad if someone can test it, and let me know what's still wrong. Be prepared to explain to me in detail, because up until now i had never had many opportunities to use this payment method.

Work in progress ..
  • any list for known issues with this patch ?
  • any list for what should be tested ?
Asking becase I might be able to spend some time later this month testing this patch - Link to tracker ?!

zanardi

  • Contributing Developer
  • Full Member
  • *
  • Posts: 878
    • GiBiLogic
Re: PayPal API updates and fixes
« Reply #5 on: March 01, 2011, 23:01:09 pm »
@edgecrafter:
thank you for your reply. By "work in progress" i mean "not yet tested enough". I should have said "BETA".

There are so many posts about PayPal API that yet have to understand which are real issues and which are just configuration errors (maybe due to unclear documentation).

I fixed some real bugs (you can search for PayPal API in the tracker), what i am asking now is to use Virtuemart 1.1.7 or 1.1.7a with this new file and just test PayPal API checkout.

If everything works fine, great. All bugs are fixed. If not, describe me exactly the issue you encounter.
--
Francesco (zanardi)
http://extensions.gibilogic.com
@gibilogic on Twitter

coachnet

  • Beginner
  • *
  • Posts: 1
Re: PayPal API updates and fixes
« Reply #6 on: March 02, 2011, 07:18:32 am »
@zanardi
I am happy to test this but after searching through every file in com_virtuemart folder, cannot find the location to place this file!

Please provide the location and I will do some testing for you!

Thanks

zanardi

  • Contributing Developer
  • Full Member
  • *
  • Posts: 878
    • GiBiLogic
Re: PayPal API updates and fixes
« Reply #7 on: March 02, 2011, 09:17:44 am »
@coachnet:
1. download the file "ps_checkout.php.txt" attached to my first post;
2. rename it to "ps_checkout.php"
3. save it in /administrator/components/com_virtuemart/classes/

Thank you.
--
Francesco (zanardi)
http://extensions.gibilogic.com
@gibilogic on Twitter

Aglobalweb

  • Beginner
  • *
  • Posts: 46
    • Aglobal Web
Re: PayPal API updates and fixes
« Reply #8 on: March 07, 2011, 22:32:24 pm »
Aglobal Web
http://www.aglobalweb.com/
Professional Joomla/Virtuemart Customization

mic2mic

  • Beginner
  • *
  • Posts: 10
Re: PayPal API updates and fixes
« Reply #9 on: March 24, 2011, 05:19:11 am »
Hello, thanks for your efforts

When I use the sanbox for payment with the Paypal API, the transaction completes but when I return to the store I see these warnings:


Code: [Select]

Warning: in_array() [function.in-array]: Wrong datatype for second argument in /mysite/administrator/components/com_virtuemart/classes/payment/ps_paypal_api.php on line 944

Warning: in_array() [function.in-array]: Wrong datatype for second argument in /mysite/administrator/components/com_virtuemart/classes/payment/ps_paypal_api.php on line 980

Warning: in_array() [function.in-array]: Wrong datatype for second argument in /mysite/administrator/components/com_virtuemart/html/checkout.index.php on line 149

Warning: in_array() [function.in-array]: Wrong datatype for second argument in /mysite/administrator/components/com_virtuemart/html/checkout.index.php on line 159

Warning: in_array() [function.in-array]: Wrong datatype for second argument in /mysite/administrator/components/com_virtuemart/html/checkout.index.php on line 182
Checkout

Warning: in_array() [function.in-array]: Wrong datatype for second argument in /mysite/components/com_virtuemart/html/checkout.index.php on line 282

Warning: in_array() [function.in-array]: Wrong datatype for second argument in /mysite/administrator/components/com_virtuemart/html/checkout.index.php on line 289

Warning: in_array() [function.in-array]: Wrong datatype for second argument in /mysite/administrator/components/com_virtuemart/html/checkout.index.php on line 297

Warning: in_array() [function.in-array]: Wrong datatype for second argument in /mysite/administrator/components/com_virtuemart/html/checkout.index.php on line 313


Warning: Invalid argument supplied for foreach() in /mysite/administrator/components/com_virtuemart/html/checkout.index.php on line 321

Warning: in_array() [function.in-array]: Wrong datatype for second argument in /mysite/administrator/components/com_virtuemart/html/checkout.index.php on line 337

Warning: in_array() [function.in-array]: Wrong datatype for second argument in /mysite/administrator/components/com_virtuemart/html/checkout.index.php on line 347

PMA

  • Beginner
  • *
  • Posts: 22
Re: PayPal API updates and fixes
« Reply #10 on: March 24, 2011, 10:46:20 am »
Hey All:

I've recieved this PAYPAL error - what do these mean?

At this time, we are unable to process your request. Please return to PAYPAL_EMAIL and try another option.

We cannot process this transaction because there is a problem with the PayPal email address supplied by the seller. Please contact the seller to resolve the problem. If this payment is for an eBay listing, you can contact the seller via the "Ask Seller a Question" link on the listing page. When you have the correct email address, payment can be made at www.paypal.com.


Parse error: syntax error, unexpected '@', expecting ')' in /home2/maicad/public_html/components/com_virtuemart/themes/vm/templates/pages/checkout.thankyou.tpl.php(61) : eval()'d code on line 208

Thanks for helping!

zanardi

  • Contributing Developer
  • Full Member
  • *
  • Posts: 878
    • GiBiLogic
Re: PayPal API updates and fixes
« Reply #11 on: March 24, 2011, 12:04:50 pm »
Please double check your e-mail address in PayPal API configuration parameters, i never heard of this issue in PayPal API module so i guess it is a misconfiguration.

Post again if you can not solve the issue.
--
Francesco (zanardi)
http://extensions.gibilogic.com
@gibilogic on Twitter

PMA

  • Beginner
  • *
  • Posts: 22
Re: PayPal API updates and fixes
« Reply #12 on: March 24, 2011, 12:39:53 pm »
Hi,

I changed the Payment class name to ps_paypal and it seems like its working...please go to Jamaicadirectdist.com


Thanks for your professional support and time.

Josh

zanardi

  • Contributing Developer
  • Full Member
  • *
  • Posts: 878
    • GiBiLogic
Re: PayPal API updates and fixes
« Reply #13 on: March 24, 2011, 12:42:34 pm »
Hmm... that sounds very strange. It should not do that, surely there has been some manual modification on your site, either voluntary or by accident.
If it works, you can leave it like that, but i suggest to check again sooner or later, maybe on a test site, what is the correct configuration.
 
--
Francesco (zanardi)
http://extensions.gibilogic.com
@gibilogic on Twitter

Alex010

  • Beginner
  • *
  • Posts: 3
Re: PayPal API updates and fixes
« Reply #14 on: March 27, 2011, 06:11:58 am »
Hello,
I have been struggling with the same problem.  If I enable PayPal (new API) as the only payment method, a credit card payment option with radio button appears during checkout along with the PayPal (new API) option radio button.  When I enable two payment methods, PayPal (new API) and credit card, an "Other Credit Card" payment option with radio button appears during check out.  In either case if I select either PayPal (new API) or "Other Credit Card" as the payment option, and continue with the checkout I get the error: 
Invalid Credit Card Number or Credit Card Verification Code.
Error: Invalid Credit Card Number or Credit Card Verification Code.
Error: Failure in Processing the Payment (ps_paypal_api)
Invalid Credit Card Number or Credit Card Verification Code

When PayPal (new API) is not enabled as a payment method, but a credit card is enabled, the checkout works fine.

I was able to enable and use just the PayPal (new API) in VM 1.1.5 by using the ps_checkout.php hack in this post:

 Re: PayPal New API Adds Credit Card Payment Option that causes error
« Reply #13 on: February 16, 2011, 19:46:18 PM »
 
Code: [Select]
// Redirect to the last step when there's only one payment method
if( $VM_CHECKOUT_MODULES['CHECK_OUT_GET_PAYMENT_METHOD']['order'] != $VM_CHECKOUT_MODULES['CHECK_OUT_GET_FINAL_CONFIRMATION']['order'] ) {
if ($count <= 1 && $cc_payments==false) {
$vmLogger->debug("Only One Payment, skipping selection");
vmRedirect($sess->url(SECUREURL.basename($_SERVER['PHP_SELF'])."?page=checkout.index&payment_method_id=$first_payment_method_id&ship_to_info_id=$ship_to_info_id&shipping_rate_id=".urlencode($shipping_rate_id)."&checkout_stage=".$VM_CHECKOUT_MODULES['CHECK_OUT_GET_FINAL_CONFIRMATION']['order']."&payment_method_ppex=2", false, false ),"");
}
elseif( isset($order_total) && $order_total <= 0.00 ) {
// In case the order total is less than or equal zero, we don't need a payment method
vmRedirect($sess->url(SECUREURL.basename($_SERVER['PHP_SELF'])."?page=checkout.index&ship_to_info_id=$ship_to_info_id&shipping_rate_id=".urlencode($shipping_rate_id)."&checkout_stage=".$VM_CHECKOUT_MODULES['CHECK_OUT_GET_FINAL_CONFIRMATION']['order'], false, false),"");
}
}