HandleURL get a list of all parameters for Paypal IPN

I am starting research on using a Xojo Web app as listener for Paypal Instant Payment Notification (IPN). It seems pretty easy to do that with HandleURL, but I am stumbling into the need to get all parameters of the POST made by Paypal onto my web app.

In php, I do

foreach ($_POST as $key => $value) { $value = urlencode(stripslashes($value)); $req .= "&$key=$value"; }

That gets me the list of parameters I can immediately after send back to Paypal to validate.

How can I do the same in Xojo Web ?

[code]The IPN message authentication protocol consists of four steps:

1.PayPal HTTP POSTs an IPN message to your listener that notifies it of an event.
2.Your listener returns an empty HTTP 200 response to PayPal.
3.Your listener HTTP POSTs the complete, unaltered message back to PayPal; the message must contain the same fields (in the same order) as the original message and be encoded in the same way as the original message.
4.PayPal sends a single word back - either VERIFIED (if the message matches the original) or INVALID (if the message does not match the original).
[/code]

I am planning to use a shell to a php script to post back with http 1.1, until Xojo.Net.HTTPSocket becomes available in Xojo Web.

I noted that there is a VB sample at the Paypal Github at https://github.com/paypal/ipn-code-samples ; it would be nice to have a Xojo one as well.

Since you’re already implementing PHP, why not do the listener with PHP and then have PHP notify your web app when the transaction is verified?

That is what I do today. As I said, I am only researching a new approach, in the perspective of doing an all Xojo listener as soon as Xojo.Net.HTTPSocket is available.

WebRequest.Entity

DefineEncoding(Request.Entity, Encodings.UTF8).Split("&")

[quote=250150:@Frederick Roller]WebRequest.Entity

DefineEncoding(Request.Entity, Encodings.UTF8).Split("&")

Great. Thank you Frederick.

Dim Parameter_String() As String = DefineEncoding(Request.Entity, Encodings.UTF8).Split("&") Dim NameValue_String() As String For Each Element_String As String In Parameter_String NameValue_String = Element_String.Split("=") If NameValue_String.Ubound = 1 Then // Process Name and Value Else // Bad data End Next

I just quickly verified with the IPN simulator ; handleURL gets all fields quite fine when the POST hits the app.

Thank you.

Nice!

Maybe getting listed as a language on the PayPal IPN docs would be a nice motivator to get Net.HTTPSocket working faster.

Alright. Console supports Xojo.Net.HTTPSocket, so I will be able to use it to post back to Paypal.

That makes me wonder. Xojo Web is supposed to be based on Console. So why would it not have the same ?

At any rate, this means it should be possible to have a listener entirely in Xojo, albeit with a helper.

Unfortunately, I do not think it would be credible to push anything to their Github with a rather hackish Console program to post back.

I will have to wait for a Xojo Web implementation of Xojo.Net.HTTPSocket.