Latest News: (loading..)
Sign in to follow this  
Followers 0
dynamoeffects

PayPal WPP Direct Payments & Express Checkout Support

4,290 posts in this topic

I forgot to mention that this probably won't play well if you've installed the Purchase Without Account contribution, but haven't tested it to know for sure.

 

This current version will create an account for the customer if one doesn't exist, but in a future version, I think I'm going to make that optional where it just adds the information to the orders table. I personally wouldn't like that as it's easier to keep track of repeat customers if they have an account, but everyone has their own methods.

 

Also, I have uploaded the pear modules to the link above, but the zip file was a little over 300k, so it should be up once approved by a mod.

Edited by dynamoeffects

Share this post


Link to post
Share on other sites
I forgot to mention that this probably won't play well if you've installed the Purchase Without Account contribution, but haven't tested it to know for sure.

 

This current version will create an account for the customer if one doesn't exist, but in a future version, I think I'm going to make that optional where it just adds the information to the orders table. I personally wouldn't like that as it's easier to keep track of repeat customers if they have an account, but everyone has their own methods.

 

Also, I have uploaded the pear modules to the link above, but the zip file was a little over 300k, so it should be up once approved by a mod.

HI Dynamo,

Thanks for the module which was much awaited I will check on this this weekend and will give My findings.

 

 

Satish

Share this post


Link to post
Share on other sites

I also imagine that it may cause problems with PWA. I guess I'll go find out....

 

As far as automatically creating an account for someone, I'd say that's a gray area at best. My two cents is to change that.

Share this post


Link to post
Share on other sites
I also imagine that it may cause problems with PWA. I guess I'll go find out....

 

As far as automatically creating an account for someone, I'd say that's a gray area at best. My two cents is to change that.

 

I'm working on integrating it with PWA. The login page will show PayPal Express Checkout, PWA, New Account, and Log In boxes, using the vertical PWA format. This requires a bit of cosmetic work on the EC addition to login.php. I've almost got it working but had to interrupt work to ship some product. I'll let you know when it's done.

 

I agree with djmonkey1 about not automatically creating accounts.

Share this post


Link to post
Share on other sites

Hi, Dynamo,

 

I have tried out your module (which is really a great one btw) and encountered the following error:

 

When I go to the checkout page, it shows login.php correctly with the Express Checkout button. However, once I clicked on the Express Checkout Button, it shows:

 

Fatal error: Call to undefined function: array() in html/login.php on line 93

 

Now I try to go back to login.php, it does not even displayed properly - I can only see the above error message. Reloading doesn't help at all.

 

Ken

 

P.S. Sorry, I forgot to also ask how to accept Transaction Currency other than USD and EUR? Thanks so much!

Edited by ken.yong

Share this post


Link to post
Share on other sites

thanks for the add, im going to test it out this weekend as well with the launch of one of my sites. thanks so much! we've been waiting so long for it.

Share this post


Link to post
Share on other sites
Fatal error: Call to undefined function: array() in html/login.php on line 93

 

P.S. Sorry, I forgot to also ask how to accept Transaction Currency other than USD and EUR? Thanks so much!

 

 

Actually, PayPal's API only supports USD right now. I just put that USD/EUR option in there for future development.

 

Did you overwrite your login.php with the version in the zip file, or did you manually update it? Post a few lines of your code around line 93. array() is a core function in PHP, so you probably just have a syntax error in there.

 

 

================================================

 

Some development notes:

-I'm working on making the automatic account creation optional

 

-Also, I'm going to make it optional if you want to automatically log the customer in if the email address returned from paypal is the same as one of your existing customers. At first I worried about that being a security risk, but an attacker would have to have already compromised the victim's email account, in which case they could just click on "Forgot my Password" and break in a whole lot easier.

 

-Last thing on the agenda is to dump the pear modules and whittle them down to one or two classes. But that's a low priority.

Share this post


Link to post
Share on other sites

SYNTAX ERROR IN V0.1

 

Somehow, two lines got truncated and the ends pushed to the next line. In the file:

/catalog/includes/modules/payment/paypal_wpp.php

 

On the ends of lines 460 and 470, the text "me'];" got pushed to the next line. Just fix it from:

 

$order->billing['name'] = $paypal_ec_payer_info['payer_firstname'] . ' ' . $paypal_ec_payer_info['payer_lastna

me'];

 

$order->delivery['name'] = $paypal_ec_payer_info['payer_firstname'] . ' ' . $paypal_ec_payer_info['payer_lastna

me'];

 

to:

$order->billing['name'] = $paypal_ec_payer_info['payer_firstname'] . ' ' . $paypal_ec_payer_info['payer_lastname'];

 

$order->delivery['name'] = $paypal_ec_payer_info['payer_firstname'] . ' ' . $paypal_ec_payer_info['payer_lastname'];

 

 

Sorry about that, but this is an alpha version. Unless you want to help root out the bugs, I suggest everyone wait until v0.2.

Share this post


Link to post
Share on other sites

im going to try to find some time in the next couple days to install and run some transactions through the sandbox.

 

So, is the "checkout without account" type mod going to be worked into this(not just for express checkout)? Im getting alot of feedback that customers want this....im id like to tackle that at the same time that I do this contrib if ti deals with the same files.

 

Also, auto-logging the customers on if their paypal address matches one of your customer email addresses sounds like a decent idea....but I guess if they are paying with paypal there wouldnt be much sense in logging them in would there? Or is that just an easy way of having their order history under their regular customer login?

Share this post


Link to post
Share on other sites

Well, here's the fat and skinny of it. If you're using the PWA mod, it creates an account for your customer, it just doesn't tell them about it. My mod does the same (except it tells them about it), but in version 0.2 of this payment module, you'll only be able to disable whether it tells them about the account or not. I'm adding a text field into the settings area so that you can set the default password to the same as the one you use for PWA, so that the two should theoretically work hand in hand. Unfortunately, theoretical PHP is like quantum physics -- just about anything's possible, but much of it will never actually work in the real world.

 

The reason that it's necessary for all customers to have an account is that many many many other checkout contributions refer to the database using the customer's ID. If I were to make this just push the order into into the $order object without creating an account, many of the contribs that people have put into their stores would simply stop functioning.

 

================================

 

And to those who've installed 0.1, I'm going to have to apologize in advance. I forgot to make it hide the "Express Checkout" boxes when you've either removed or disabled this payment module, so you're going to have to redo the modifications in login.php and checkout_shipping.php.

Share this post


Link to post
Share on other sites

Hi, Dynamo,

 

Here is the original script in the login.php file which has the syntax error (line 93 on login.php):

 

//---PayPal WPP Modification START ---//
 if (tep_session_is_registered('paypal_error')) {
$checkout_login = true;
$messageStack->add('login', $_SESSION('paypal_error'));
tep_session_unregister('paypal_error');
 }
//---PayPal WPP Modification END ---//

 

I actually overwrote the file with the your file, i.e. I did not make any modifications.

 

Thanks again!

Share this post


Link to post
Share on other sites

Great contribution dynamo. Is there any way of displaying the exact error code from paypal? Every card I try is getting declined but that is just a generic messsage for every non-successful transaction. I need to know what the exact problem is so I can fix it. Thanks

Share this post


Link to post
Share on other sites
Great contribution dynamo. Is there any way of displaying the exact error code from paypal? Every card I try is getting declined but that is just a generic messsage for every non-successful transaction. I need to know what the exact problem is so I can fix it. Thanks

 

Actually I got the same problem too. I used a real card to try and it got declined as well.

Share this post


Link to post
Share on other sites

Okay I found a way to get the error code and message. This is the error message:

 

Direct Payment has been disabled on this account. Transaction has not been processed.

 

I am using a sandbox business account and have everything set up. I also have live business account and tried it there and it didn't seem to go through too.

Share this post


Link to post
Share on other sites
Okay I found a way to get the error code and message. This is the error message:

 

Direct Payment has been disabled on this account. Transaction has not been processed.

 

I am using a sandbox business account and have everything set up. I also have live business account and tried it there and it didn't seem to go through too.

 

 

Okay, i got it to work. I think my sandbox account was just misconfigured somehow. Then I ran into timeout errors. I think it should be mandatory that you raise $timeout in /catalog/pear/Services/PayPal/SOAP/Transport/HTTP.php

Share this post


Link to post
Share on other sites

Ken, I actually ran across that error for the first time today too. Strange how it didn't show up before I packaged it. Change:

 

Change the line:

$messageStack->add('login', $_SESSION('paypal_error'));

 

to

 

$messageStack->add('login', $paypal_error);

 

You'll also have to do that in checkout_shipping.php.

 

 

I've actually been getting errors all day trying to process. Unfortunately, it's just a generic "This transaction couldn't be processed. Tell the customer to use another form of payment" when using Express Checkout. Still not sure if it's the code, one of my sandbox accounts, or an act of God.

 

In this next version, it'll return the error message along with the error code received from PayPal. I should have the revised version out in a couple days.

Share this post


Link to post
Share on other sites

Hi, Dynamo,

 

After I changed it and click on the Express Checkout button, I got returned to the login page and it says at the top in a pink box:

 

payment_error=paypal_wpp&error=An+error+occured+when+we+tried+to+process+your+credit+card.+

+Please+try+again%2C+or+if+you+continue+to+have+problems%2C+please+choose+another+form+of+

payment.++Thanks%21

 

It didn't take me to the Paypal website at all. I guess this is the same error when you tried all day today?!

 

BTW, GREAT GREAT CODE!! Clean and easy to follow/modify.

 

Ken

Edited by ken.yong

Share this post


Link to post
Share on other sites

Does someone happen to have a live site that I could look at with this installed?

Share this post


Link to post
Share on other sites
It didn't take me to the Paypal website at all. I guess this is the same error when you tried all day today?!

 

Change the $timeout variable in /catalog/pear/Services/PayPal/SOAP/Transport/HTTP.php to 300 and see if that fixes your problem. If it doesn't go to PayPal at all, either your API username/password are wrong, your certificate isn't installed or is corrupt, or it's just timing out. In this next version there's better error handling, so it'll be easier to debug this kindof stuff. (Unless you get this damn generic error message that I've been getting)

 

Thanks for the compliment. What's funny is I've been fixing the FUBAR'd formatting that Notepad++ did where it seemingly switched randomly between spaces and tabs. The code looks beautiful in Notepad++, but when looking at it on my server through vi, the first words out of my mouth were "GAH!".

Share this post


Link to post
Share on other sites

Finally, figured it out!!

 

It looks like if your Sandbox user is a verified customer (meaning there's a bank account attached to it), that it'll throw up the "This transaction cannot complete successfully" error. Looks like a bug in the Sandbox. I'm willing to bet that the fake bank account number they're using in the Sandbox is depleted and when it tries to pull money out, it just fails.

 

Can anyone else duplicate this error?

Share this post


Link to post
Share on other sites

OK, I went throught the install yesterday and I have a few questions.

 

1) To alternate between sandbox/live testing do I need to request api access in both environments?

 

2) I still get the generic "Your card has been denied...." error everytime I try to use a credit card. Is the snippett of code mentioned above supposed to give me more descriptive error?

 

3)Would I get this error if my api access credentials were incorrect?

 

Thanks for your time.

 

-bharper

Edited by bharper

Share this post


Link to post
Share on other sites

1. Yes, you need an API certificate and username/password in both environments.

 

2. Are you using a test card number or a real one? If you use a test card number in a live environment, it'll fail.

 

3. Could be, but because the error responses in 0.1 are so worthless it's tough to say.

 

Version 0.2 should be finished today, which is much more stable. In the mean time, if you don't have a sandbox account, go ahead and sign up and get your API cert and credentials so you can test it out there.

Share this post


Link to post
Share on other sites
3. Could be, but because the error responses in 0.1 are so worthless it's tough to say.

 

 

It was indeed my api access credentials. It worked first time through after I got those right. I sure am glad you can issue refunds for 60 days!

 

So, Im not quite clear about switching from sandbox to live testing... do i need to have both api access certs in the wpp_cert directory or do I switch them out? I guess i could leave them both in and just point the module to the correct one depending on live/sandbox.

 

Thanks again for your time/code. Nice work.

 

-bh

Edited by bharper

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0