Jump to content

Anybody works with AlertPay's IPN? It's killing me.


Akkari

Recommended Posts

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 {

Link to comment
Share on other sites

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.  :)

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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.  :D

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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!  :D  :D

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.