Integrate BeanStream Payment Gateway

Posted in API, Payment Gateway, Web Tagged , , , , ,

Problem

Integrate BeanStream payment gateway in a web-application built using the wordpress framework. The Application is for a small hotel and there is a dedicated page from where the users who are interested in booking rooms can specify their booking date, room type and confirm the booking by paying the amount for the same.

Solution Provided

An order form was created on the hotel booking page, it had all the fields added for taking the users information. The merchant id was obtained from the merchant login. It was integrated as hidden field in the payment form. The payment related fields like credit card number, name, address, expiry date, city, province, country were all integrated on the same page.

The information entered was validated for correctness and then the user information was posted on the BeanStream server payment URL via a PHP Curl Request.

This ensured that the user was not redirected away from the parent website. The Curl response was captured and the payment completion status was obtained from it. If the transaction was Approved then the user was redirected to the payment completion page , else to the cancel/failure page.

The payment notification URL was defined in the payment gateway merchant login and data sent on that URL was used to update the database with the booking information of the user.

The entire code was first built as an independent prototype and after it was tested with test and live payment transactions, it was modified to integrate into existing word-press platform. The tests were repeated after integration in word-press.