Jump to content
  • entries
    2
  • comment
    1
  • views
    5,205

Surya Kanta Mekap

3,054 views

One of our client wanted us to build a solution for them to process credit cards from a FileMaker application with authorize.net and merchant account gateway.

All we wanted to do is to capture the Credit Card data and send it to the iPad filemaker app and then send it to the web-service of the payment gateway.

Filemaker API and Payment Gateway:

Initially we made the integration using a hosted Filemaker file and PHP server; the processing worked well.

Below are steps explaining the same,

1. In filemaker, the web-viewer will contain the payment form from web server. The web- viewer works same like other standard web-browsers like safari, mozilla etc..

2. On submission of the form with the credit card details, the web-server will get the credit card details along with the order id(primary key of order).

3. Then a connection will be made to the filemaker database to retrieve the payment gateway details like: payment URL, API-login-id and Transaction-key.

4. After getting the details of payment gateway, we will post the credit card data along with API-login-id and Transaction-key to the payment URL for payment

process. I have followed following method to post the data to payment url:

Data array to be posted:

$post_values = array(

"x_login" => " API-login-id",

"x_tran_key" => "Transaction-key",

"x_delim_data" => "TRUE",

"x_delim_char" => "|",

"x_relay_response" => "FALSE",

"x_invoice_num" => "order id",

"x_method" => "CC",

"x_card_num" => "card number",

"x_exp_date" => "expiry date",

"x_amount" => "payment_amount",//like: 0215

"x_type" => "type of transaction" //like: AUTH ONLY, PRIOR_AUTH_CAPTURE etc..

// Additional fields can be added here as outlined in the AIM integration

// guide at:

);

Then convert the array into authorize supported data. Authorize supported data like

"x_login=username&x_tran_key=a1B2c3D4"

$post_string = Authorize supported data string.

Post the data to payment URL for payment process:

$request = curl_init(payment URL); // initiate curl object

curl_setopt($request, CURLOPT_HEADER, 0); // set to 0 to eliminate header info

from response

curl_setopt($request, CURLOPT_RETURNTRANSFER, 1); // Returns response data instead of TRUE(1)

curl_setopt($request, CURLOPT_POSTFIELDS, $post_string); // use HTTP POST to send form data

curl_setopt($request, CURLOPT_SSL_VERIFYPEER, FALSE); // uncomment this line if you get no gateway response.

$post_response = curl_exec($request); //execute curl post and store results in $post_response

curl_close ($request);

5. The response from authorize is a string. All the data will be separated by the delimited character. Here it is '|'. So we will convert the response string into array by using explode function and retrieve the transaction details as below:

$response_array = explode('|', $post_response);

Retrieve transaction detail:

$xresponse_code = $response_array[0];

$xresponse_reason_text = $response_array[3];

$xtrans_id = $response_array[6];

$xorder_id = $response_array[7];

$xamount = $response_array[9];

6.If the $xresponse_code is one, then transaction is being successful. Show a successful message in the web-viewer.

7.If the $xresponse_code is not equals to one, then transaction is unsuccessful. Show an error message($xresponse_reason_text ) in the web-viewer.

8.We have the order id for which the payment is done. Now we need to update the payment details like: transaction id, payment amount etc.. for that order.

Find the record and get the id:

$find_record = $db_obj->newFindCommand('layout name');

$find_record->AddFindCriterion('field name', 'auto-increment id value');

$find_record_result = $find_record->execute();

$record = $find_currency_result->getFirstRecord();

$record_id = $record->getRecordId('');

Edit the record:

$edit_record = $db_obj->newEditCommand('layout name', $record_id);

$edit_record->setField('field', 'value');

.

.

$result = $edit_record->execute();

The problem with the above procedure requires to host the file on the Filemaker server as we are making a db connection to get the payment gateway details, and hence we have to access the app on the iPad remotely.

This added some restriction to the mobility as we need to be within the LAN area or else we will be loosing connection with the server, hence the processing and updating of record will be affected, so we decided to make the app resident on the iPad itself.

Now we required a third party app to integrate with FilemakerGo application and as we are not able to install plugins for the Filemaker Go so we looked forward for third party apps supporting URL schemes.We found the "Credit Card Terminal" from innerfence serving the purpose.

Credit Card Terminal:

The above app is free on the App Store and also gives away a free Credit Card when we signup as a new merchant.

For this to work on the iPad we need to make use of URL Schemes

The URL protocol allows FileMaker Go to communicate with other iOS applications.

Learn more:

http://help.filemaker.com/app/answers/detail/a_id/7786/kw/fmp7script

URL Scheme used (Its URL Encoded):

Th above URL takes us to the CC Terminal application on the Ipad and then will ask us to swipe in the credit card details, after processing the card it will send us back to the FM Go file called "POS.fmp12” and will start executing the script called "CallBackScript".

We can pass as much info from FM Go to CC terminal as we want by setting the other query string parameters in the base URL, I have just passed the amount and email in the above example.

The other parameters that we can pass on the URL is here on this page

https://github.com/innerfence/ChargeDemo

The "returnURL" is responsible for the call of “CallBackScript” script in the “POS.fmp12” file. The results of the charge will be returned via this return URL by including additional query string parameters which gets automatically declared. We can set those variables into our fields directly.

$ifcc_responseType - approved, cancelled, declined, or error

$ifcc_transactionId - transaction id (e.g. 100001)

$ifcc_amount - amount charged (e.g. 10.99)

$ifcc_currency - currency of amount (e.g. USD)

$ifcc_taxAmount - tax portion from amount (e.g. 0.93)

$ifcc_taxRate - tax rate applied to original amount (e.g. 8.5)

$ifcc_tipAmount - tip portion from amount (e.g. 1.50)

$ifcc_redactedCardNumber - redacted card number (e.g. XXXXXXXXXXXX1111)

$ifcc_cardType - card type: Visa, MasterCard, Amex, Discover, Maestro, Solo, or Unknown

Below is the encoded return URL.

Encoded returnURL=
fmp:%2F%2F<IP_Address>%2FPOS.fmp12%3Fscript%3DCallBackScript

UN-Encoded returnURL=

<IP_Address> needs to be replaced by the IP address on which the filemaker file is hosted, this needs to be replaced by “~” if the filemaker file is resident(local) on the Ipad.

The above app charges some monthly amount and Interchange fees.

Other better pricing offers are also available for high volume purchase for the Credit Card Terminal.

Learn more:

http://www.innerfence.com/apps/credit-card-terminal

http://www.innerfence.com/apps/credit-card-terminal/developer-api

https://github.com/innerfence/ChargeDemo

Addition of a monthly fee and per-charge transaction fee cuts further into profit, so we looked forward for an app that will help us read the magnetic stripe from the Credit Card and process the Credit card using payment gateway API through web viewer.

CCQ-FM:

Now we need to get rid of the intervention of the filemaker server, so no Filemaker API is used, we planned to give away the details needed for processing on the URL itself in some encrypted format from the web viewer after getting the request the API will decrypt then will parse and process the card and will send the response back to the requested client on the URL itself.

On the Filemaker Go we will be executing a timer script to check for the response available or not using the GetLayoutObject("webviewer", "source") for a preset time.

When the response is available it parses the data and updates different fields for to log the transaction results on the filemakerGo application and shows the user about the payment processing details.

The first character in the request must be a ‘?’.

We have to add the string containing our protocol for return data. CardSwipe® will append the data from the mag stripe to the end of our request. We have to replace any spaces with %20.

Using the FMP7Script ( and FMP for FileMaker Go 12 ) protocols

CardSwipe® will return the swipe data at the end of our url string.

For a local database named Invoice.fp7 (.fp7 is optional) and a script named Process Scan our call would look like this:

For FileMaker Go 12 our call would look like this:

CardSwipe® will return the mag stripe data as a script parameter.

We can add parameters and variables

For FileMaker Go 12:

This will create a variable $CCData that will contain the mag stripe data.

The tilde ~ character prior to the database name indicates that it is a local database if the database is hosted then the IP address should be sent instead of the tilde.

Additional instructions for FileMaker available at: http://www.ccq-fm.com/fmgo_development.pdf

You can download the integration guide at http://www.ccq-fm.com/CardSwipeIntegrationGuide.pdf

Please refer to the applications documentation for further information.

The CCQ-FM can itself be used without any other API to process credit cards and it has also got PA-DSS Certified Credit Card Processing for Filemaker Systems and the Web.

CardSwipe:

http://www.filemaker.com/company/media/press-releases/releases/3p_2011/ccq-fm_inc_announces_ccq-fm_2v1_pa-dss_certified_credit_card_processing_for_filemaker_systems_and_the_web.html

http://www.ccq-fm.com

Any of the above methods could be used as the situation demands. You can decide which of the above methods fits your necessity well. There are other Ipad/Iphone apps too that can be used to process credit cards from FilemakerGo app, we need to check for

the support of URLScheme for that app to communicate with the Filemaker app.

Surya Kanta Mekap

Software Developer, Mindfire Solutions, India

http://www.mindfiresolutions.com

email:[email protected]

Skype: mfsi_suryam

1 Comment


Recommended Comments

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.