Hi,
Does any one know how to integrate payment gateway in openfl? I am developing android app using openfl and I need to integrate payment gateway in that app. But I don’t find any library for this. Any help in this regard will be much helpful. I want to integrate payment gateway like Paypal, Razorpay etc.
I don’t know for existing payments gateway , but you can try to integrate it yourself.
At example, Are those payment gateway have a Android package ? If so . you can create externs for them ( which is easy fot Android , example : OpenFL Extensions – I Call Haxe! )
Other solution, if they accept only API calls, is to use URLLoader and URLRequest classe to create a http requests.
Thanks for quick reply. They accepts API like https://razorpay.com/docs/api. So when I will use URLLoader and URLRequest then whether the control will go from app to payment gateway website and then come back from website to app?
URLLoader and URLRequest are just simple http requests. You will receive response from the server in json format and you should manage that response.
You can freely looks for flash examples , such as actionscript 3 - Send POST request with custom headers using flash - Stack Overflow and http - Basic Authentication with Flash - Stack Overflow or other libraries to see how can create such requests for Razorpay REST API
Here is OpenFL documentation too:
openfl.net.URLRequest - API Reference
openfl.net.URLLoader - API Reference
Thanks for clarifications. I will look at the API reference for details. One thing more. Is there any way to manage user session in openfl? I mean login/logout for users in openfl. If yes then please send me details.
User sessions are managed on the server side via session ( using cookies in most cases). You should check headers for a session cookie and store it / check it. I do not have details how can you do it . You should try to find more information in stackoverflow or other sites.
When I search for the term “openfl cookie” on google then I am getting reference of the page js.Cookie - Haxe 4.2.1 API. So I think I will have to make use of Haxe Cookie Class to handle cookies on client side in openfl program. Please confirm this.
OpenFL should automatically manage cookies in version 9.2.0 and newer when using URLLoader.
When I am running the command openfl on terminal then I am getting following message:
OpenFL Command-Line Tools (9.2.0-L2PRs1)
So it is version 9.2.0? Will it manage cookies automatically?
Yes, with that version, it should manage cookies for you automatically.