Disease :
Prescription :
Depending on the payment system, there are a number of different options.
Option 1 : Use the payment provider web application that handles payment
This is probably the best way to integrate as the payment provider will handle the full payment and has to take care of security. Most of the payment providers will provide you with an html application that you can integrate into your own application, and which is running on a secure environment.You would forward your user to this HTML page.
When the payment transaction is done,
the payment service will return your customer to your application and provide
it with information on the transaction. So your
Flex application will not even see any credit card details !
So how can you integrate this secure HTML payment application into your Flex application ? The best way is to show the application in an
iFrame on top of your Flex application. The Flex application will be able to communicate with the iFrame through
FABridge. FABridge is an Adobe javascript library that allows flash player to interact with the HTML container and the other way around.
Alistair Rutherford wrote a
post on how to use an iFrame on top of your Flex application.
The solution Ogone is providing is
Ogone e-commerce. I have build an example integrating Flex with Ogone e-commerce. You can find the source code here.
Here in a few steps what you need to take care of :
1. PaymentEvent.as : Custom event that is used to pass the payment data to the HTML page running in the iFrame.
2. iFrame.as : iFrame component build by Alistair RutherFord
3. Add the FABridge javascript library to ‘html-template/index.template.html’ and add the .js itself.
4. ogone_html.html : html file that will runn in iFrame. Main part is an HTML form that we’ll submit to the Ogone server. Notice how I added an event listener for the Payment event, and i fill in the form and submit it. Also check the form to see what is configurable on the payment side.
5. ogone_bevestiging : html file that will be called by Ogone when transaction is over. Ogone will call this html file with an attribute indicating the status of the transaction. When this page is loaded you can see in the load() function I’m calling the transactionOver() function in my Flex application (Ogone.mxml). TransactionOver function will take as an argument the transaction status and show it in my Flex application.
You can find the source files on
here
And have a look at the application
here. (Use this test VISA number : 4111 1111 1111 1111)
Option 2 : Use the payment provider API’s.
In this case you’ll build the UI that will handle payment details yourself, which means you’ll be responsable for providing the necesary security measures. After collectint the credit card details you’ll be using the API’s to handle the payment.
So depending on the API technology you’ll have to use a specific solution :
Tips to stay healthy :
Taking care of payments is a delicate thing. Check out legal and security issues. Try to go for solution 1, which will put those responsibilities on the payment provider.