Today I’m releasing an ActiveMerchant adapter for iPay88. iPay88 is a popular payment processor in Malaysia. You can grab the code off GitHub or you could also grab the
bitfluent-activemerchant gem to start using it today. Hopefully upstream will merge it into the official repository soon.
Accepting iPay88 Payments with Ruby on Rails
It’s pretty easy to start using the adapter in your app. The following examples are all on Ruby on Rails 2.3.8.
Add the gem to config.gem (or Bundler if you like)
Add an initializer to set your iPay88 Merchant Key (they’ll give this to you after a long arduous signup process which includes tons of paper work, bank statements, company registration, a visit to their office in Cheras and faxing. YES, FAXING!)
Assuming you have an
OrdersController#paywill be the page where you’ll craft a special form to POST to iPay88 to kickoff the payment process.
OrdersController#returnwill be the page iPay88 will return to after the payment process is completed. iPay88 will actually POST to this action hence the route specifying
return- this was surprising to me. This is where you will check the status of the payment and display to the user a success or fail/retry page.
Throw in a “Processing …” header and spinner and you’re almost there!
Hopefully the user is able to perform the payment after enduring a million popup windows that is iPay88’s horrible user experience.
Finally, the user is returned to your app via
OrdersController#return. Check if the payment was successful and you are done!