I am trying to set up IPN on the Simple Commerce module. I have verified sandbox seller and buyer accounts, my ‘buy now’ link works and the PayPal return to store link works. $debug is set to TRUE and my index.php page does not have restricted access.
I placed the following code in the mod.simple_commerce.php:
{if logged_out} <p>You must be registered and logged in before you can purchase the HotBod programme.</p> {if:else} {exp:simple_commerce:purchase entry_id="107" success="site/payment_success" cancel="site/index"} {item_name} <p><strong>{item_sale_price}</strong></p>
<p><a >Buy Now</a></p> <p><a >Add to Cart</a></p> <p><a >View Cart</a></p>
{/exp:simple_commerce:purchase} {/if}
The Buy, Add and View links have onclick=“window.open(this.href, ‘paypal’); return false;” in them.
Edit - Just tested out using the conditional on a logged_out tag and seems to work although I can’t find it mentioned in the documentation anywhere. Not sure now if that will be your problem or not as it seems to work as it should do. Would like to know from the team now as to whether we can use that tag in that way? . Again hope you get your problem sorted soon.
Don’t know if this is the problem or not but I don’t think you can have :
{if logged_out}
{if:else}
{/if}
I think you can only have :
{if logged_out} Content here… {/if}
{if logged_in} Content here… {/if}
Might be wrong on that one but might be worth a try with that. If I am right then I am guessing that what is happening is that logged-out people (guests) are being allowed to purchase items?
Thanks Mark. I made the change you suggested but still get the same result.
I do recall seeing that advice before but I had forgotten. I had better check my other pages for the same issue, although it doesn’t appear to be cause of the problem in this case.
Yes sorry about that. Just saw the code above and didn’t recognise it as standard practice so thought the conditional might not be working correctly. Seems as though this does work although I haven’t seen it documented anywhere or at least I don’t think I have.
Have you gone through all the processes with setting up the sandbox environment. I remember having real problems getting mine to work ages back now and I had done everything that was in the documentation but then I remember checking in one of the accounts (sorry can’t remember which now as it was such a long time ago) and looked on the left hand column and it said that I needed to set something else up to be verified. Once I did that everything was fine. I seem to remember having to set up quite a few things just to get it to work. Seems a bit weird to me that you have to set up so many items for a sandbox. Why you can’t just enter an e-mail address and be done with I’ll never know!!
Yes the Sandbox can be a real pain to set up at times. I remember when I did it that I had to setup loads of stuff just to get it working. I think there was one tiny little piece of information or something silly that wasn’t in the ExpressionEngine documentation that you had to do on PayPal’s side for it to work. I think that PayPal changed what information was required to ask for more and that’s why it wasn’t in the documentation.
Pretty annoying really as it is after all just a Sandbox, they don’t (in my mind anyway) need all that information surely just for you to get a test bed area? Crazy!!
My apologies, ryal001. This one completely slipped by us on reply. If that ever happens, do bump it. We like to get things fixed for you- and in a speedy manner.
That said- ‘blarg’ to paypal. I’ll test on my sandbox today, see if maybe they’ve changed something on their end. They’ve been known to do so. It may also have been a matter of sandbox setup. You need to have both buyer and seller ‘approved’ in the test setup. Which can be convoluted.
Yes, I switched to using “live” details and both the PayPal and Simple Commerce automated emails were all sent, the purchase was recorded in EE and my test customer was moved into the “paid” member group. Thus, everything seemed to work as advertised.
It would be good to get Sandbox working for test purposes but I can live without it. It’s probably one little thing that I’ve done or not done. PayPal seem to make everything as obtuse as possible; I spent ages looking for an “enable” or “setup” button for Website Payments Standard before I eventually realised that it’s enabled by default once you have a verified business account.
mrwarren - were you able to get the live site working? This may be worth splitting to a new thread to investigate separately anyway.
Rob - we commonly see issues with unverified buyers/sellers - and the sandbox, I believe, has to have its own users verified separately since it’s a complete test environment. Could that be the potential cause of the failure?
In any case, it’s up to you if you wish to pursue this or not - if you’d rather not work through it, then let me know and we can consider it a done deal since the live stuff works. =)
Funny, I switched to Live site and it didn’t work, then I switched back to sandbox and got it working. The site is still in development, so I am not in a position to test live again until a bit later. I’ll fire up another post if it’s still giving me problems.
Is Simple Commerce getting much of an update w/ 2.0? As it is, the documentation could use a serious overhaul. The step by step instructions are pretty opaque. I’m constantly feeling like I’m missing something. Maybe I am? There’s some awesome tutorial somewhere? That’d be wonderful!
Hi, mrwarren - glad to hear you got the sandbox working. Do post again if you need help with going live. As far as your other questions, you can, of course, put in a feature request for more documentation or other features with the Simple Commerce module.
But let’s keep this thread on track. Rob - let us know if what I said sounds like a potential issue.
I will check again later (at work at the moment), but I’m sure all the sandbox accounts are verified.
My understanding is that the IPN wouldn’t work at all if the accounts weren’t verified. As noted above, I could be wrong but PayPal does seem to be sending an IPN response, it just isn’t recognised by Simple Commerce.
Let us know what you find out about the verification. Also, can you confirm what version and build of EE you’re on, and any extensions you may be running?
I confirm that all the test accounts are enabled and verified.
There are three email accounts, one is my actual email address (e.g. rob@abc.com), one is a test business account (e.g. rob2_1215555042_biz@abc.com) and one is a personal test account (e.g. JohnDo_1217211896_per@abc.com).
I have tried using both rob@abc.com and rob2_1215555042_biz@abc.com as the PayPal account in the Simple Commerce settings.
I am using EE 1.6.4.
Extensions:
Register Birthday (v.1.0)
File, by Mark Huot (v.3.1.1)
First Timer (v.1.0.0)
Register Occupation