News:

Support the VirtueMart project and become a member

Main Menu

Open Source PayPalPro U.S. for Virtuemart 1.1.2

Started by Metric, October 09, 2008, 23:33:45 PM

Previous topic - Next topic

Metric

Greetings,

Today, I am releasing the integration method that I have been working on in the past month. It is currently being used in a live site at www.killerpecans.com. However, they did not want Express Checkout Activated.

Features:

   1. Uses PayPal's new NVP system of communication

   2. Automatically confirms payment status without having to use PayPal's IPN callback system.

   3. Does not need any modifications to the Virtuemart Database.

   4. Fully integrated and working PayPal Express Checkout.

   5. Fully integrated and working PayPal Direct Payment.

   6. Lists all items purchased on PayPal details page for both parties.

   7. Fully integrated into the standard checkout process of Virtuemart.

   8. Express Checkout uses the Ship-To address provided by the user when checking out in Virtuemart.

   9. Full Open Source - Licensed under GPL v3.0

View it here at: http://demos.gfx-null.com/paypalpro/

You can download it, view screen shots, or give the express checkout a test run using your own beta-developer paypal account. If you do not have a beta developer PayPal account then you can get one at https://beta-developer.paypal.com/

The installation instructions are right there on the front page of the demo site.
If you have any problems I will be glad to help. Hopefully, I made it quite clear on how to go about installing it. If not, let me know how I can improve it.

Do note, when you sign-up to try out the shopping cart, you need to enter a valid U.S. address into virtuemart. Otherwise, PayPal will spit back a warning noting that the address is not confirmed but the payment was accepted. However, when it does it, it will not let virtuemart enter the order into the database due to how the error is processed and displayed in virtuemart.

I do plan on adding a feature where you can select to override the confirmed address when sending an express checkout request to PayPal. Though, it may be a while due to a new project that will take some time to complete. Thus, I have to put others on the back burner.

If the Virtuemart Developers would like to include this in future Virtuemart editions, by all means do, as I do not have an issue with that. All I ask, is that I receive credit and or be listed as a contributor to the development of Virtuemart.

If you have any questions please post them here. No, I am not out to make any money with this. I have found Virtuemart an invaluable tool in helping set up quick shopping cart solutions for clients. I just want to give something back to the community.

NOTE: This does not work with Virtuemart 1.0.x. It only works on Virtuemart 1.1.2 and future editions. Since, it uses the new theme system to help with the integration into the checkout process.

If you find any bugs, or need help please use the contact form on the demo site.

Enjoy,
Metric / Aaron Klick

Metric

UPDATE:

If you previously downloaded the add-on, please download the newer version PayPalPro v1.0.1. A major bug was fixed in this revision, that caused a Live PayPal account not to work with Express Checkout.

You will have to re-configure the payment option by re-adding your API Signature and other options, because of major changes to the configuration options.

Change Log:

### Version 1.0.1 - PayPalPro - 10-11-08

Added: Require Confirmed Address Override Option.

Removed: CVV Check Option - Was not implemented fully. Therefore it has been removed.
                 PayPal requires an CVV code for Direct Payment.
                 CVV code is now required always for Direct Payment.

Bug Fixes:

    1. Fixed spelling error for Live PayPal Express Checkout URL.
           The URL was missing some letters.

           Caused PayPal Express Checkout not to work for a Live PayPal Account. 

Metric

UPDATE 10-27-08:

Again if you have previously downloaded the add-on I recommend downloading the newer version PayPalPro v1.0.2. Another major and I mean major bug was squashed this time.

You will have to re-configure the payment option by re-adding your API Signature and other options, because of a new configuration option being added.

Change Log:

###Version 1.0.2 - PayPalPro - 10-27-08

Added: An option to turn off the display of error messages. If they are not displayed they are still written to the debug log file.
       Recommened off on Live sites.

Bug Fixes:
    1. There is a bug in Virtuemart where the order_total variable is not calculated properly when the total order amount exceeds $100.
        -Implemented work around for correct pricing in the PayPalPro module. So, that PayPal will not throw an Item Amount does not match Order Amount Error.
        -The work around calculates the order total properly by going through each cart item and getting the original base price.
        -Then multiplying the price based on quantity of that item. Finally, the tax total and shipping total amounts are added to it.
        -This creates the proper price.
        -You will notice on the final confirmation stage of checkout that Virtuemart displays the correct order total.
        -However, the order total variable that is stored for payment modules is not calculated properly.

Metric

UPDATE 10-28-08:

I have taken the download link offline, due to severe issues in the 1.0.2 version.

A new version with the fixes and new features will be posted some time tomorrow evening on 10-29-08 CST.

Metric

UPDATE 10-29-08:

###Version 1.0.3 - PayPalPro - 10-28-08

Added: Re-added CVV choice for ON or OFF. Fully implemented this time.

Added: Payment module now works with coupon discounts.

Added: New error handling method.
      -Even if you turn off PayPal errors in the config, a certain few will still be visible to the user. For example for direct payment: Invalid Credit Card
      -Invalid CVV Code, Credit Card Declined Message, and so forth.
      -For example with express checkout: PayPal session timeout errors, PayPal Session already used, PayPal Session exceeded max attempts to process
      -and so forth.
      -With this new error handler, I can add new ones on request. I have added what I think are the primary ones of concern. However,
      -if you would like to see some others please let me know.
      -Also the user is shown a very easy to understand message for the error. Instead, of debug messages that you get with the PayPal Errors On in the config.
      -Again, I recommend turning off PayPal Errors when going Live so users do not see debug information. With this new method users will still see the most important
      -error messages for the user.

*See - https://www.paypal.com/en_US/pdf/PP_NVPAPI_DeveloperGuide.pdf - for the different errors.


Added: GPL v3.0 License to Zip File. - Should have done this from the beginning, sorry. =[

Notes:
    Virtuemart 1.1.2 has a known bug of not representing the total order price of items properly with coupon discounts and when it exceeds $100 per order on the checkout page.
        -Nevertheless, I have implemented a work around for these issues. So, if you notice the paypal transfer is slightly different it is due to proper
        -calculation via the PayPalPro payment module. Instead, of using the order total variable provided by Virtuemart which is inaccurate in Virtuemart 1.1.2.
        -I know for a fact the calculations are correct to do numerous hand calculation with calculators and different check out prices.
        -It seems somehow Virtuemart is adding more cents than should be or not enough cents at times.
       
        -The below examples are of actual checkouts on my test site with the PayPalPro v.1.0.3
       
        -For example: take 6 products at $19.99 each and 4 products at $2.99 each. $19.99 x 6 = $119.94, and $2.99 x 4 = $11.96.
        -So the subtotal should be $131.90. Then say we use a 8.25% sales tax we then calculate $131.90 x 0.0825 to get $10.88
        -when rounded to 2 decimal places. Virtuemart does calculate the tax amount properly.
        -Then say we add $6.16 in shipping the total will be $131.90 + $10.88 + $6.16 = $148.94.
        -However, Virtuemart displays an improper amount usually sometimes like $148.90 or $148.97.
        -Thus, the order_total variable will have the improper amount at either $148.90 or $148.97.
       
        -This also applies to when adding coupons.
        -For example: let just say we have the same products above with a subtotal of $131.90.
        -Then we use a coupon that supposedly subtracts $4.00 from the total.
        -The method used to get around this is to find the total number of products in the cart first: 6 + 4 = 10.
        -Therefore, we divide the discount $4.00 / 10 = $0.40 per product to subtract. So now we take our original base price:
        -$19.99 - $0.40 = $19.59 per item for that type, and $2.99 - $0.40 = $2.59 per item for that type.
        -So if we were to times the new price by 6 and 4 respectively we will get: $117.54 + 10.36 = $127.90
        -Now if we took the original subtotal of $131.90 - $4.00 = $127.90.
        -The tax is still calculated based on the original base price of items. So it is still $10.88, and our shipping is still $6.16
        -Hence, $127.90 + $10.88 + $6.16 = $144.94, but Virtuemart does not calculate the price correctly this time around either.
        -Again, it will be something like $144.90 or $144.97, and that goes same for the order_total variable.
       
        -Just test it out on the demo shopping cart I have setup and you will see how the price changes at the different
        -checkout processes, when the order is over $100 or when using a coupon. Heck even add the test3 coupon code in and test it with a coupon even.
        -Then if you want to see if it works setup a beta-developer.paypal.com test account.
        -and use the express checkout to see how the PayPal total is properly calculated compared to Virtuemarts total.

RolandD

#5
Hello Aaron,

I am testing your payment method on my dev site. When I try to do the Express Checkout I get the following error:
Fatal error: Maximum execution time of 60 seconds exceeded in xxx/components/com_virtuemart/themes/default/templates/checkout/request_paypal.tpl.php on line 101

I have looked at the code but no idea what I am looking for :)
Edit: Some testing shows I get the security header issue here too. It might be nice to show that error rather than a timeout.

Now using regular check out I get the error:
Error - Paypal did not complete the transaction - FAILURE - SHORTMESSAGE =Security error - ERRORCODE =10002 - LONGMESSAGE =Security header is not valid -
These are the same credentials I used for another Paypal pro mod available here and that went fine.

Edit2:Ok, I removed all my test accounts and created a brand new one. This one is a verified business account with test mode enabled. I have received the API credentials for this account. Now I updated the config settings with my new API credentials and get stuck on a different error: Error - Paypal did not complete the transaction - FAILURE - SHORTMESSAGE =Authentication/Authorization Failed - ERRORCODE =10002 - LONGMESSAGE =Username/Password is incorrect. By now I have triple checked that I copied the right API credentials, so I am sure those are correct. What am I missing?  ???

Thanks for any help.
Regards,

RolandD

CSVI
http://www.csvimproved.com/

Metric

#6
--Edit
When I was about to hit the sack tonight, I realized that the first error message was definitely an error on my part.

I forgot to increase the count variable in the while loop. Therefore, if there is an error on the express checkout it will stay in the while loop indefinitely. Thus, causing the fatal error that you see.

I will have this fixed tomorrow, and will implement a little something else to go along with it for debug / sandbox testing purposes.
--/Edit

The first error message has nothing to do with my code. Instead, it has to do with your web server settings.

Looks like the execution of the code exceeded a 60 second limit that was imposed by your server. It looks like it was trying to access the Response array from paypal for the errors when the fatal error happened.

The second error has to do with your web server not having a valid Security header when being sent to paypal. My question is, do you have ssl enabled on your dev site? If so, could the ssl for the dev site be expired?

I know this due to having enabled a test SSL certificate on my demo site, but it was not a valid certificate. Therefore, it threw the same error, and I disabled it and just had virtuemart point to a regular http:// when checking out.

The third one, make sure you are using the beta-developer.paypal.com developer account, and that the module is switched to YES for sandbox mode.

Also, if you are using beta-developer.paypal.com account, then make sure you didn't accidentally copy any spaces when copying and pasting. I know it can happen, because I caught it doing it myself when I was copying and pasting from the paypal site. Check the end of the password / username / signature for spaces in the module config.

I hope this helps,
Metric / Aaron Klick


Metric

UPDATE 11-3-08:

If you have v1.0.3 installed then you only need to download the update package v1.0.3 to v1.0.4.


###Version 1.0.4 - PayPalPro - 11-3-08

Added: Implemented PayPal debug messages for express checkout.
        -Only displayed if the PayPal Error option is turned on in the module config.
        -Otherwise, a nice clean message is displayed that tells the user
        -to contact the website administrator.
       
Bug Fixes:
        1. Fixed the indefinite loop in the PayPal Express Checkout when
            -an error was sent back from PayPal.
        2. Fixed error message loop for Express/Direct that would skip error messages
            -due to double counting of the loop counter.

mestophales

I have noticed that when I configure the PayPal module and set a successful transaction to pending so I do not have to manually vett a sale to enable the download, that if a customer goes out to paypal and simply goes back to the site they trigger the pending status and get the download link and never have to pay for it.

Just FYI

Metric

#9
Quote from: mestophales on December 11, 2008, 18:36:50 PM
I have noticed that when I configure the PayPal module and set a successful transaction to pending so I do not have to manually vett a sale to enable the download, that if a customer goes out to paypal and simply goes back to the site they trigger the pending status and get the download link and never have to pay for it.
Just FYI

EDIT: mesto could you email the link to the site that has it setup and has the problem so I can see what exactly is happening. Then, maybe I will be able to repeat the bug with a test server. Thus, I will probably be able to determine the location of the bug quicker. email: aaronklick A.T. gmail D.O.T. com

Thanks,
Metric / Aaron

Thanks for reporting this mesto. Sorry, I couldn't reply sooner, but I have been working on a big website project and really haven't checked the site in a while.

I have a feeling this has to do with how virtuemart assigns a pending status to the orders and not my paypal pro plugin. However, I will take a look into my code and see what is going on and make sure it isn't the plugin causing it.

It will probably be a week or so more before I can take a look at it and see why it is doing that.

Next time, if anyone wants a faster response please just email me at the provided addresses at the top or on my website. My email is always checking for incoming messages and I can usually respond on the go with my iPhone.

kontrolfreek

#10
ok i installed it, had a few problems like i ended up going to step 5 of 3 and got like 4 errors on the page, decided i dont really want to use express check out anyway, i replaced the files you said back up and now on my check out page, my continue shopping and checkout text is cut off short, how do i fix it back so its not cut off, thanks.



fixed it

Rodrigo01

you can change the template??

maybe only ocurrs whit your dark template

mole84

just had a successful live test with VM 1.1.2, thanks for all your hard work Metric


Metric

UPDATE 04-13-09:

You must download the full install due to changes in the configuration and certain bug fixes. You will have to re-enter your API Username, Password, and Signature.

###Version 1.0.51 PayPalPro - 4-13-09
Improvements:
        1. Added the option to disable the regular Direct Payment Checkout
            - If both direct payment and express checkout are disabled
            - then direct payment method will still show
        2. Automatically remove white spaces from the username, password and signature
        3. Added a second configuration file.
            - All new configuration features will be added to this one.
            - No more having to reset the username, passowrd, and signature after this one!
           
Bug Fixes:
        1. Fixed an issue that was not allowing the module to run on Joomla 1.1.x anymore.
       
TODO:
    See Below
       
###Version 1.0.5 PayPalPro - 4-8-09
Improvements:
        1. Updated custom form information to now match the new current VM 1.1.3 coding
        2. Removed lingering divs that were messing up peoples checkout page / order page.
        3. No longer a paypal image icon for express checkout. Now it is just a plain old text hyperlink.
Bug Fixes:
        1. Fixed an issue that was making people on Joomla 1.5.8+ run in legacy
            -Mode in order to be able to use the express checkout.
            -You will now be able to run with legacy mode turned off.
        2. Fixed an issue where if paypal did not respond with an Transaction ID
            -from a credit card type purchase. Virtuemart would
            -go ahead and place the order as pending.
            -This is no longer the case it will now toss an error stating
            -for the person to try again a little later.
        3. Fixed an issue that if the paypal credit card transaction
            -went through but did not succeed Virtuemart
            -would still set order as Pending.
            -It will now set those type of orders to your Canceled Settings.

TODO:
        1. Add more custom friendly error messages for more of the PayPal Errors.
        2. Clean up sections of the code and add more commenting
        3. Move the Error Messages into Language Files ? Maybe even though this is for U.S. Only.