9/6/2010 1:18:44 AM
Title:
Payment Gateway Integration with Flex
Folks
I am doing a payment gateway integration with Flex. What are the best options?
The PG provider in my case provides a HTTP-based API for posting the transaction details. I can easily do this with action script, however he will POST back to a URL where I have to listen for success/failure.
How can this be achieved without directing my users to a HTML page from flex for payments?
thanks!
Harsh
Shawn
Points: 680
Posts:0
9/6/2010 3:09:59 AM
HTML redirection will only occur if you will load payment gateway page in your browser. If you are posting data from flash to there page then you can load the result in flash and parse the resulting data to see if transaction finished or not. The loaded data may be htm data , so you need to parse the html data.
9/6/2010 5:15:35 AM
you should use webservice for this if your payment gateway provides this.
Other wise you can redirect to empty page with just success written inside. Now when you post data to your gateway it will return you your page with text success, read it in flex and display the success message
9/6/2010 11:39:52 PM
Hi All
thanks for the response. I am not sure if I understand you clearly.
The PG offers HTTP-based API to which I POST from Flex. It also asks for a redirect URL as one of the POST parameters. Once the PG is done with the transaction, it will redirect success/failure response to the redirect URL after the transaction is done.
Now my flex webApp is hosted in http://mydomain/index.html. Once I POST from my flex webApp to the PG, it will redirect after success/failure to the redirect URL I provide.
My question: what should the redirect URL be? How can I load this within flex?
thanks a lot!
Regards
9/7/2010 6:22:11 AM
In case of http based service , redirection can only occur if you load the url in browser on post request. Means if you service page for posting details is abc.php then if its being executed in browser it can execute and redirect to another url, but in your case you are using flash to submit data to this url ,which is background process and is not running in the browser itself, so it won't redirect at all.
As Andrid said if you create a page on your website named "success.html" with only "success" text inside, no html tags and use this page as url to redirect on success. Then on submitting your request to http service you should get that page as result.
var request:URLRequest = new URLRequest("http://abc.com/postData.php");
var loader:URLLoader = new URLLoader();
loader.dataFormat = URLLoaderDataFormat.VARIABLES;
loader.addEventListener(Event.COMPLETE, completeHandler);
private function completeHandlerWs(event:Event):void {
var myLoadedData:URLLoader = URLLoader(event.target);
//you will get the data here as "success" in recievedText variable
receivedText = myLoadedData.data;
if(receivedText=="success"){
trace("Transaction done")
}
}
1/20/2011 3:44:36 AM
Hi to all,
am also having similar requirement and how to integrate with payment gateway with input as objects.
Thanks in advance.