Page 1 of 1

Need help with paypal payment gateway

Posted: Fri Apr 15, 2011 6:33 am
by caciavar
I'm developing a site with Calguys Ecommerce solution. Currently using the following modules:

Products
2.10.3

Orders
1.11.4

Cart
1.7.5

CGEcommerceBase
1.2.4

CGPaymentGatewayBase
1.0.9

PriceBasedShipping
1.1.1

PaypalGateway
2.3.3


I have spent over a month working through bugs, customizing templates, and customizing layouts. I am close to finishing this site, but the logic behind notification of completed orders seems broken to me.

This is a description of the issue that needs to be resolved:

There is some weird logic surrounding Orders and Paypal IPN. IPN notifications of an order approval trigger user e-mails with "approved" status. Redirects backs to my site from paypal always set the order status to "pending" and trigger user e-mails with "pending" status. This order of e-mail notifications ("Order approved" then "Order pending") is confusing to a customer. The order history shows "approved" then "pending". The admin log shows events in this sequence as well. The user always lands back on the cmsms site with a "pending" message instead of "order completed" message. I THINK the problem has to do with the logic class.orders_gateway_helper.php script but I can't say for sure. If I use PDT instead of IPN, everything works well, but if the customer closes the browser before redirecting back to the site then the order administrator does not receive an e-mail notification, and the customer does not recieve an 'order confirmed' e-mail.

It seems like a shame for me to abandon this project after so much time and effort has been spent learning these modules, learning more about cmsms and, at times, learning more about myself too ;). It also seems like a shame to ignore the broken logic and allow users to potentially be confused by what they see.

The site is in dev so I don't mind sharing access to the backend or paypal developer accounts.

Thanks,
-Chris

Re: Need help with paypal payment gateway

Posted: Fri Apr 22, 2011 12:19 am
by pixelita
PM me or email me at joni@pixelita.com. Our developer is working on a similar project for us right now.

Re: Need help with paypal payment gateway

Posted: Sun May 29, 2011 3:49 pm
by stevew
Hi,
Did you find a solution to this? I seem to be having a similar problem. I'm using CMS-MS 1.9.4.2 and these modules:
Cart 1.8.1
CGEcommerceBase 1.3.1
CGExtensions 1.25.3
CGPaymentGatewayBase 1.0.10
CGSimpleSmarty 1.4.8
FrontEndUsers 1.12.16
Orders 1.12.6
PaypalGateway 2.3.4
Products 2.12
SelfRegistration 1.6.10

Using Self-Registration with paid registration. After apparently successful PayPal payment, my Admin log reads:

Orders Attempted to set status of order 4 backwards from PAID to PENDING 05/29/11 17:33:54
PaypalGateway:ipn IPN Transaction 7NN50324EK575503C successful. Status: Completed 05/29/11 17:33:51
Orders:gateway_event Processed Transaction 7NN50324EK575503C for Order 4 05/29/11 17:33:51
Orders Order status set to Paid 05/29/11 17:33:51
Orders 30.00 received for order 4 (transaction id: 7NN50324EK575503C) 05/29/11 17:33:51
SelfRegistration User swaller registered 05/29/11 17:32:31

Another indication of error is that in the on-screen invoice message after payment, the transaction ID is missing. The message reads: "Your transaction ID: has been completed, and a receipt for your purchase has been emailed to you."

I'd be grateful for any tips.

Re: Need help with paypal payment gateway

Posted: Sun May 29, 2011 10:17 pm
by myshko
Hi all,

Have you tried following the steps in this post:

http://forum.cmsmadesimple.org/viewtopi ... 5&p=172043

From your descriptions it seems like there is a mismatch with IPN.

And the paypal gateway works best with both PDT and IPN enabled.

Regards,

M

Re: Need help with paypal payment gateway

Posted: Mon May 30, 2011 5:00 pm
by stevew
Thank you for your response. It turns out that the transaction is being correctly completed and recorded in the buyer and seller accounts in the Paypal sandbox, and both the buyer and the seller are getting their notification emails. So the only problem, if it is one, is the message in the CMSM-MS Admin log about "attempting to set the order status back from Paid to Pending", which apparently has to do with the order in which the IPN and PDT notifications are received. In any case, for any other queries I'll move this over to the Modules board.

Re: Need help with paypal payment gateway

Posted: Mon May 30, 2011 5:15 pm
by myshko
Steve,

Seems like something mismatched in your PDT settings.

If the transaction ID is not displaying, it could be your key.

Could you post / pm them (your test settings)?

Or double check the PDT Identity Token in your paypal gatway prefs matches that in your sandbox seller profile, that 'auto return' is on and that the 'return url' at least points to the root of your site.

Also, in your paypal gateway prefs, that your test business email is correct.

Regards,

/m

Re: Need help with paypal payment gateway

Posted: Mon May 30, 2011 5:26 pm
by calguy1000
If IPN is configured PDT is not used.
If using IPN you MUST setup the return url properly in the paypal (real, or sandbox) settings. Or none of the transactions will complete.

Re: Need help with paypal payment gateway

Posted: Mon May 30, 2011 5:34 pm
by myshko
Please correct me if I'm wrong,

I thought the 'paypal gateway'used both IPN and PDT, to get around limitations with each method respectively?

IPN (optional) to confirm the status silently in the backend between paypal and 'Orders'.

And PDT when your are redirected and see the confirmation message on the frontend?

I might be incorrect though, just curious.

Thanks,

M

Re: Need help with paypal payment gateway

Posted: Mon May 30, 2011 5:46 pm
by stevew
Calguy, thanks, the return URL is the checkout page (checked again and again). In any case, all transactions *do* complete in Paypal - that's not the problem. The problem, if it is one, is the Admin log entry that says:
"Attempted to set status of order %s backwards from PAID to PENDING"
Apparently, acording to the comments in class.orders_gateway_helper.php, that has to do with "maybe the async stuff came in BEFORE we got here synchronously". I don't know if this is just information or an error warning.

Re: Need help with paypal payment gateway

Posted: Mon May 30, 2011 6:05 pm
by calguy1000
it's just informational.