OSCOMMERCE SUPPORT CALL 702-453-3332

 

Help - Search - Members - Calendar
Full Version: PayPal WPP Direct Payments & Express Checkout Support
osCommerce Community Support Forums > osCommerce Online Merchant v2.x > Contributions / Add-Ons > Payment Modules > Other
Pages: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68
dynamoeffects
This is the support thread for the PayPal Direct Payments & Express Checkout module. Please post any bugs or errors you see while using it so that they can be fixed.

The contribution can be found here:
http://www.oscommerce.com/community/contributions,3647
dynamoeffects
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.
satish
QUOTE (dynamoeffects @ Oct 11 2005, 03:33 PM) *
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
djmonkey1
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.
SteveDallas
QUOTE (djmonkey1 @ Oct 11 2005, 03:17 PM) *
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.
dynamoeffects
Sounds like a concensus. smile.gif I'll make it an option in the next version.
ken.yong
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!
cwdmark
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.
dynamoeffects
QUOTE (ken.yong @ Oct 12 2005, 03:59 AM) *
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.
dynamoeffects
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.
Sid04
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?
dynamoeffects
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.
ken.yong
Hi, Dynamo,

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

CODE
//---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!
kinetek
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
ken.yong
QUOTE (kinetek @ Oct 12 2005, 04:34 PM) *
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.
kinetek
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.
kinetek
QUOTE (kinetek @ Oct 12 2005, 05:32 PM) *
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
dynamoeffects
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.
ken.yong
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
linuxdave
Does someone happen to have a live site that I could look at with this installed?
dynamoeffects
QUOTE (ken.yong @ Oct 13 2005, 12:58 AM) *
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!".
dynamoeffects
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?
bharper
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
dynamoeffects
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.
bharper
QUOTE (dynamoeffects @ Oct 13 2005, 07:59 AM) *
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
dynamoeffects
Version 0.2 has just been finished and uploaded!

If you installed 0.1, you're going to have to go through all the OSC core files you modified in the first one and redo them. Sorry about that, but that shouldn't happen again. Also note the the paypal_wpp.sql file adds one extra column that v0.1 didn't, so don't forget to do import that.

The zip file alone is 20k larger than v0.1's, so many changes have been made and a few more core files have been modified. Automatic account creation is now optional (a temporary account is still created, but deleted at the end of checkout) and error messages now include the ones returned from PayPal. The changelog in the readme file lists all the updates.

Thanks to everyone who sent me bug reports, this version is MUCH more stable than 0.1 and better suited for a production environment.
bharper
This is probably due to something else I did .... I get this when trying to go to "My Account" or "Cart"

Warning: Cannot modify header information - headers already sent by (output started at /usr/www/users/gf/gf/catalog/includes/languages/english.php:341) in /usr/www/users/gf/gf/catalog/includes/functions/general.php on line 29

Have you seen this before?

I'm kinda new to php BTW - java guy.

-bh
dynamoeffects
It'll do that if there are carriage returns under the last ?>
bharper
QUOTE (dynamoeffects @ Oct 13 2005, 11:15 AM) *
It'll do that if there are carriage returns under the last ?>



Thanks. Sorry for the remedial PHP questions.. I haven't learned all the quirks yet.

-bh
ken.yong
Hi, Dynamo,

I have updated to the new version. I get the following error:

[ERROR]
An error occured when we tried to contact PayPal's servers.

()
[/ERROR]

It should be my individual Paypal problem, right? I have already changed this line:

var $timeout = 4;

to

var $timeout = 60;

Ken
SteveDallas
I'm getting the same error:

An error occured when we tried to contact PayPal's servers.

()
dynamoeffects
Very very strange, it's working for me. Is this when you click the Express Checkout button, or try to use Direct Payment?
ken.yong
QUOTE (dynamoeffects @ Oct 13 2005, 01:04 PM) *
Very very strange, it's working for me. Is this when you click the Express Checkout button, or try to use Direct Payment?


Hi, Dynamo,

It's when I click the Express Checkout button.

Ken
dynamoeffects
When you removed the old payment module and installed this one, did you remember to redo your settings? I just did an order on my dev cart and it completed and added the money to my sandbox account, so not sure what's going on. The files I'm using are the same ones I packaged and uploaded.
ken.yong
Yes, I have written down the settings and retyped those in. It still said "An error occured when we tried to contact PayPal's servers."

Ken
SteveDallas
In my case, I had renamed the certificate from cert_key_pem.txt to cert_key_pem_sandbox.txt and forgot to update it. EC is working now. On to test DP.
ken.yong
I think I might have a clue... I am hosting with GoDaddy, they require that I use their proxy for all SSL CURL post. Do you know where should I put curl_setopt functions for proxy in your php files?

I am confident it will work this time when the proxy thing goes through.

THANK YOU VERY MUCH! DYNAMO!!! I REALLY REALLY APPRECIATE ALL YOUR CONTRIBUTIONS!

Ken
dynamoeffects
I have already found a bug in create_account.php, though. I've uploaded a new version of that page to the contributions. Use it to overwrite or modify your existing create_account.php.

Ken, I'm willing to bet your solution is similar to SteveDallas'. Recheck your settings, make sure the certificate is still in place, and try again.

I honestly never expected this module to be this complex. Sheesh!
dynamoeffects
Ken, it'd be somewhere in the pear modules, but couldn't tell you where off the top of my head.
SteveDallas
Brian,
I want to thank you for all your hard work on this module. I have successfully processed both Express Checkout and Direct Payment transactions in the Sandbox.

I have some order flow and cosmetic issues that I'd like to address:

1. If you log in or checkout without an account (PWA), the EC button appears at the top of checkout_shipping.php. I think that a better placement would be on checkout_payment.php, along with the other payment methods.

My reasoning is that a customer, who either logged in, created an account, or used PWA to checkout, has already been presented the EC button, so there is no reason to present it a second time. A returning customer who logged in before checkout has already provided his shipping information, so should be able to confirm it and then select EC on the payments page. This appears to be in harmony with PayPal's business rules.

2. When Express Checkout has been selected as the payment method, the checkout confirmation page displays the payment method as "PayPal Direct Payment & Express Checkout". I realize that this is the module name, but is there a way to display it as "PayPal Express Checkout" without splitting the payment module into two parts?

3. When presenting payment options, checkout_payment.php displays the module name, but the module only offers the direct payment options. In addition, the PayPal name shouldn't even appear for direct payments. A generic "Credit Card" text would be more appropriate. I haven't dug into the architecture deeply enough to determine whether this can be done easily.

I'm curious as to what others think about these issues.

--Glen
ken.yong
I totally agree with SteveDallas on Point 1 and 3.

In addition, PWA works well - No problem at all.
dynamoeffects
QUOTE (SteveDallas)
1. If you log in or checkout without an account (PWA), the EC button appears at the top of checkout_shipping.php. I think that a better placement would be on checkout_payment.php, along with the other payment methods.


Unfortunately, PayPal has specified the exact placement of their Express Checkout button. It must show up in the checkout process before you ask your customer for their shipping information. The main goal of this module has been to make it fully compliant with PayPal's TOS, so for that reason alone I won't change it in the official contrib. I suppose you could change it on your individual store, though. I really doubt if PayPal would ever cause a stink.

QUOTE (SteveDallas)
2. When Express Checkout has been selected as the payment method, the checkout confirmation page displays the payment method as "PayPal Direct Payment & Express Checkout". I realize that this is the module name, but is there a way to display it as "PayPal Express Checkout" without splitting the payment module into two parts?


Sure, that wouldn't be too hard to do. I'll probably release a v0.3 in a couple days to fix any new bugs that pop up and I'll get that in there.

QUOTE (SteveDallas)
3. When presenting payment options, checkout_payment.php displays the module name, but the module only offers the direct payment options. In addition, the PayPal name shouldn't even appear for direct payments. A generic "Credit Card" text would be more appropriate. I haven't dug into the architecture deeply enough to determine whether this can be done easily.


Edit the file: /catalog/includes/languages/english/modules/payment/paypal_wpp.php and change the "MODULE_PAYMENT_PAYPAL_DP_TEXT_TITLE" line to whatever you want.
bharper
QUOTE (SteveDallas @ Oct 13 2005, 02:30 PM) *
3. When presenting payment options, checkout_payment.php displays the module name, but the module only offers the direct payment options. In addition, the PayPal name shouldn't even appear for direct payments. A generic "Credit Card" text would be more appropriate. I haven't dug into the architecture deeply enough to determine whether this can be done easily.



This is easily changed in /includes/languages/english/modules/payment/paypal_wpp.php on line 8.

If you change it here it will also alter how it is displayed in the admin=>payment modules section.

-bh
SteveDallas
QUOTE (bharper @ Oct 13 2005, 02:05 PM) *
This is easily changed in /includes/languages/english/modules/payment/paypal_wpp.php on line 8.

If you change it here it will also alter how it is displayed in the admin=>payment modules section.

-bh


The problem is that the same variable (MODULE_PAYMENT_PAYPAL_DP_TEXT_TITLE) is also used to display the payment method in checkout_shipping.php, so EC payments show up with a payment method of "Credit Card" if you change it. Therefore, making the payment method show up correctly both in the payment method list and in the confirmation requires a bit more magic. I'll have a more detailed look at it.

--Glen
SteveDallas
QUOTE (dynamoeffects @ Oct 13 2005, 02:04 PM) *
Unfortunately, PayPal has specified the exact placement of their Express Checkout button. It must show up in the checkout process before you ask your customer for their shipping information. The main goal of this module has been to make it fully compliant with PayPal's TOS, so for that reason alone I won't change it in the official contrib. I suppose you could change it on your individual store, though. I really doubt if PayPal would ever cause a stink.


In this case (user was presented the EC button and chose something else), I believe that it is reasonable to hide the button on the shipping address page. However, when he gets to the payment selection page, he should still have the opportunity to select PayPal if he changed his mind during the checkout process. The rules for the placement of PayPal with other payment methods should apply at this point.

--Glen
ken.yong
Hi, another problem.... My Express Checkout button is returning error 10417. I know this is not an issue of the module so I have contacted Paypal for help. They asked me if I can provide my logs of SOAP requests and responses. They are looking for the XML documents that are sent to PayPal and the XML documents returns to my server in the process of performing the Express Checkout. There should be three API calls, each with its own request and response document.

In addition, they asked what PayPal SDK, if any, is the module using?

Any help on how to retrieve or turn on logging of SOAP requests and responses will be greatly appreciated!!

Ken
SteveDallas
I'm new to PHP and osCommerce, but I have been programming off and on for years. I have figured out how to make the payment method show up correctly for both Express Checkout and Direct Payments.

Add these lines to catalog/includes/languages/english/modules/payment/paypal_wpp.php:

define('MODULE_PAYMENT_PAYPAL_DP_TEXT_EC_TITLE', 'PayPal Express Checkout');
define('MODULE_PAYMENT_PAYPAL_DP_TEXT_DP_TITLE', 'Credit/Debit Card');

In catalog/includes/modules/payment/paypal_wpp.php, change:

$this->title = MODULE_PAYMENT_PAYPAL_DP_TEXT_TITLE;

to

if (tep_session_is_registered('paypal_ec_token') && tep_session_is_registered('paypal_ec_payer_id') && tep_session_is_registered('paypal_ec_payer_info')) {
$this->title = MODULE_PAYMENT_PAYPAL_DP_TEXT_EC_TITLE;
} else {
$this->title = MODULE_PAYMENT_PAYPAL_DP_TEXT_DP_TITLE;
}


If I monkey around with it a bit more, I might be able to make the original title show up in the admin module.

--Glen
dynamoeffects
QUOTE (ken.yong)
Hi, another problem.... My Express Checkout button is returning error 10417.


That's the generic error I was getting yesterday. Unverify your sandbox user by deleting the bank account and then try again (you'll have to turn off the Verify check in the module admin). As I mentioned before, I think the fake bank account number they give us is depleted and so, thinking the user can't pay, it tells the customer to use another form of payment.


QUOTE (ken.yong)
In addition, they asked what PayPal SDK, if any, is the module using?


2.0
dynamoeffects
QUOTE (SteveDallas @ Oct 14 2005, 12:32 AM) *
However, when he gets to the payment selection page, he should still have the opportunity to select PayPal if he changed his mind during the checkout process.


I can agree with that. I didn't have it show up again simply because if the user is logged in, and skipped past Express Checkout (maybe even twice), I'd personally prefer them use Direct Payment. I'll make it an option in 0.3 to display an express checkout button on the payment page.
SteveDallas
QUOTE (dynamoeffects @ Oct 14 2005, 03:58 AM) *
I can agree with that. I didn't have it show up again simply because if the user is logged in, and skipped past Express Checkout (maybe even twice), I'd personally prefer them use Direct Payment. I'll make it an option in 0.3 to display an express checkout button on the payment page.


For the time being, I'm just using the PayPal IPN payment contribution to handle this choice.

While fooling around with things last night (well, around 3AM), I added a capability for payment modules to display an icon with the module name. Once I figured out how payment modules interact with checkout_payment.php, it was pretty straightforward.

--Glen
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2008 Invision Power Services, Inc.