Akkari Posted June 4, 2010 Share Posted June 4, 2010 Hey everyone. If someone familiar with the alertpay IPN could help me out; I'd really appreciate it. Now what I did was really, really, really and really simple...lol. I just downloaded their sample IPN handler which can be found here: http://dev.alertpay.com/en/resources/sdks-and-sample-codes/doc_download/1-sample-ipn-handler-for-items.html It's really a quick read, will take three minutes so please go through it. Now the only thing that I have done is make it send me an email when the test transaction goes through. And that never happens. Now what I have basically added is that part: else { if ($transactionStatus == "Success") { if ($testModeStatus == "1") { // Your site is currently being integrated with AlertPay IPN for TESTING PURPOSES // ONLY. Don't store any information in your production database and // DON'T process this transaction as a real order. $to = "MY-EMAIL-ADDRESS"; $subject = "Test mail"; $message = "Hello! This is a simple email message."; $from = "no-reply@MY-DOMAIN"; $headers = "From: $from"; mail($to,$subject,$message,$headers); } else { Quote Link to comment https://forums.phpfreaks.com/topic/203891-anybody-works-with-alertpays-ipn-its-killing-me/ Share on other sites More sharing options...
icefire Posted June 4, 2010 Share Posted June 4, 2010 i think there is a space before first else Quote Link to comment https://forums.phpfreaks.com/topic/203891-anybody-works-with-alertpays-ipn-its-killing-me/#findComment-1067892 Share on other sites More sharing options...
Akkari Posted June 4, 2010 Author Share Posted June 4, 2010 haha, thanks but this is quite different than your earlier headers already sent problems.. . No space. Still looking for help Quote Link to comment https://forums.phpfreaks.com/topic/203891-anybody-works-with-alertpays-ipn-its-killing-me/#findComment-1067895 Share on other sites More sharing options...
dabaR Posted June 4, 2010 Share Posted June 4, 2010 Did you test that code within if ($testModeStatus == "1") { gets executed? You could put die('BALH'); Quote Link to comment https://forums.phpfreaks.com/topic/203891-anybody-works-with-alertpays-ipn-its-killing-me/#findComment-1067906 Share on other sites More sharing options...
Akkari Posted June 4, 2010 Author Share Posted June 4, 2010 Did you test that code within if ($testModeStatus == "1") { gets executed? You could put die('BALH'); I could but remember that this is an IPN file. Meaning the file never gets accessed directly and so never outputs anything. The payment processor simply sends POST variables to the file which are then converted into local variables by using $_REQUEST and then compared. However to answer your question, yes, this argument evaluates true. Quote Link to comment https://forums.phpfreaks.com/topic/203891-anybody-works-with-alertpays-ipn-its-killing-me/#findComment-1067913 Share on other sites More sharing options...
dabaR Posted June 4, 2010 Share Posted June 4, 2010 AFAICT there is nothing wrong with the code inside the if block. Quote Link to comment https://forums.phpfreaks.com/topic/203891-anybody-works-with-alertpays-ipn-its-killing-me/#findComment-1067918 Share on other sites More sharing options...
Akkari Posted June 4, 2010 Author Share Posted June 4, 2010 Yeah, well bascially that's why I was hoping that someone who has dealt with their IPN handler before would know what's going on. Thanks a lot though, dabaR Quote Link to comment https://forums.phpfreaks.com/topic/203891-anybody-works-with-alertpays-ipn-its-killing-me/#findComment-1067925 Share on other sites More sharing options...
dabaR Posted June 4, 2010 Share Posted June 4, 2010 You're welcome. I will keep subscribed to the thread, and please post when you find out. I can't think of any other problem than that code in that block never gets executed, or potentially some email delivery problem, so I would like to learn something new if you find out a different cause. Quote Link to comment https://forums.phpfreaks.com/topic/203891-anybody-works-with-alertpays-ipn-its-killing-me/#findComment-1067927 Share on other sites More sharing options...
Akkari Posted June 4, 2010 Author Share Posted June 4, 2010 Well bascially you might just be giving yourself a huge, unneccassry headache if you don't work with AlertPay. If it wasn't a client request, I wouldn't have come near playing around with their IPN. Working with payment gateway IPN and APIs gives me the creeps anyway...lol. I hope someone could help me. In the meantime, I'm trying to sort things out with an integration specialist on their end, see if it's something on their end. Quote Link to comment https://forums.phpfreaks.com/topic/203891-anybody-works-with-alertpays-ipn-its-killing-me/#findComment-1067929 Share on other sites More sharing options...
PFMaBiSmAd Posted June 4, 2010 Share Posted June 4, 2010 Meaning the file never gets accessed directly... But, you could always browse to the file yourself for testing purposes to get it to the point where your email (or it would probably be better to use error_log() to write information to a file) actually works. Temporarily set values in the code for $merchantEmailAddress, $mySecurityCode, $transactionStatus, and $testModeStatus to get the code to take the execution path you want. Have you successfully even sent an email to yourself from the server using the values you are putting into the mail() function? Quote Link to comment https://forums.phpfreaks.com/topic/203891-anybody-works-with-alertpays-ipn-its-killing-me/#findComment-1067933 Share on other sites More sharing options...
Akkari Posted June 4, 2010 Author Share Posted June 4, 2010 Have you successfully even sent an email to yourself from the server using the values you are putting into the mail() function? You bet I did OK, applying your suggestion now, let's see how it goes. If it works, then it's definitely something on their end. I don't know how I didn't think of setting temporary values for them. I'll follow your instructions and report back, thanks a bunch. Quote Link to comment https://forums.phpfreaks.com/topic/203891-anybody-works-with-alertpays-ipn-its-killing-me/#findComment-1067939 Share on other sites More sharing options...
dabaR Posted June 4, 2010 Share Posted June 4, 2010 Ya, I knew that was the case. Quote Link to comment https://forums.phpfreaks.com/topic/203891-anybody-works-with-alertpays-ipn-its-killing-me/#findComment-1067945 Share on other sites More sharing options...
codebyren Posted June 4, 2010 Share Posted June 4, 2010 I'm just going to throw this out there since it's a common problem between developers and payment gateways: Are you expecting AlertPay to be able to make a POST to a page on your localhost? Keep in mind that there's no way their servers can reach, for example: http://127.0.0.1/test/callback_page.php - so your script is possibly never even being hit. Quote Link to comment https://forums.phpfreaks.com/topic/203891-anybody-works-with-alertpays-ipn-its-killing-me/#findComment-1067985 Share on other sites More sharing options...
Akkari Posted June 7, 2010 Author Share Posted June 7, 2010 But, you could always browse to the file yourself for testing purposes to get it to the point where your email (or it would probably be better to use error_log() to write information to a file) actually works. Temporarily set values in the code for $merchantEmailAddress, $mySecurityCode, $transactionStatus, and $testModeStatus to get the code to take the execution path you want I can't thank you enough for the two suggestions in bold. I kept tracking down errors from missing bracelets to problems on AlertPay's end. The major problem I was having is that my client couldn't possibly understand that the IPN security code is to be generated ONCE. When I told him generate a new one for me he did, he gave it to me then clicked generate again, he treated it like some kind of coupon code generator. So I was left with a whole bunch of security codes and don't know what is working and what's not. I simply used error_log() in the if() that checked the IPN security code and viola! My email kept receiving "IPN security code mismatch". Anyway, now when the customer successfully checks out, he gets sent an email attachment containing his ebook (php email attachments are another story! lol). Thank you very much for everyone that has contributed to this thread. I just thought of updating it so that whoever was subscribed would be able to see how it went. I think I have kinda a solid understanding of AlerPay's IPN after this experience..lol, if anyone is struggling with it specifically; I can do my best to help. Thanks again everyone! Quote Link to comment https://forums.phpfreaks.com/topic/203891-anybody-works-with-alertpays-ipn-its-killing-me/#findComment-1068900 Share on other sites More sharing options...
dabaR Posted June 7, 2010 Share Posted June 7, 2010 Quote Link to comment https://forums.phpfreaks.com/topic/203891-anybody-works-with-alertpays-ipn-its-killing-me/#findComment-1068914 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.