How To: Integrate Credit Card and ACH / E-Check processing into FileMaker

This is the ninth part in a series of postings on how to integrate credit card and ACH/E-check transactions into various systems. This installment demonstrates code used for processing payments (credit card and/or ACH) within a FileMaker application.

This was taken from the NELiX TransaX FleXport toolkit documentation. Credit card integration examples can be downloaded on the NELiX TransaX FleXport page.

Assumptions:
- Using NELiX TransaX Payment Gateway
- Communicating using NELiX TransaX Webservice
To accomplish a web service connection within FileMaker, we used the Troi URL Plug-in, a very inexpensive plug-in which allows FileMaker to easily post to a web resource.  This plug-in is available at http://www.troi.com/software/urlplugin.html.   Version 2.0.3 of the plug in is also included along with the example, but of course a license must be purchased from Troi before putting into production.  Once purchased, a permanent license key will be generated and sent to you from Troi.

Copy the plug in into your FileMaker extensions directory (both Windows and Mac plug-ins are included).

After being installed, we use FileMaker Scripts and Calculations to run the transaction.

First, we create a calculated filed to compose the XML payload needed to run the transaction. Here is an example calculation as seen in our example file. The fields here can be replaced with fields from your database, and elements that you will not use can be dropped from the calculation.

// REQUIRED FOR ALL TRANSACTIONS

"" & transactiontype & ""
& "" & username & ""
& "" & password & ""

// MERCHANT DEFINED FIELDS - UP TO 20 ARE SUPPORTED

& "" & merchantdefined1 & ""
& "" & merchantdefined2 & ""

// VOID TRANSACTION
// used to void a transaction prior to settlement. TRANSACTION ID is required. Payment Type is required if this is a "check" transaction.

& If ( transactiontype = "void" ; "" & transid & "" & If ( paymenttype = "check" ; "" & paymenttype & ""; ""); "")


// REFUND TRANSACTION
// used to refund a previous transaction. AMOUNT and TRANSACTION ID are required. Payment Type is required if this is a "check" transaction.

& If ( transactiontype = "refund" ; "" & amount & "" & "" & transid & "" & If ( paymenttype = "check" ; "" & paymenttype & ""; ""); "")

// CAPTURE TRANSACTION
// used to capture a previously auth'd transaction. AMOUNT and TRANSACTION ID are required. Payment Type is required if this is a "check" transaction.

& If ( transactiontype = "capture" ;
"" & amount & ""
& "" & transid & ""
& "" & orderid & ""
& "" & tracking_number & ""
& "" & shipping_carrier & ""
& If ( paymenttype = "check" ; "" & paymenttype & ""; ""); "")

// UPDATE TRANSACTION
// used to update shipping and tracking information in the gateway. Payment Type is required if this is a "check" transaction.

& If ( transactiontype = "update" ;
"" & transid & ""
& "" & tracking_number & ""
& "" & shipping_carrier & ""
& If ( paymenttype = "check" ; "" & paymenttype & ""; ""); "")

// VAULT DELETE CUSTOMER TRANSACTION
// used to remove a customer from the vault. CUSTOMER VAULT ID is required.

& If ( customer_vault_action = "delete_customer" ; "" & customer_vault_action & "" & "" & customer_vault_id & "" ; "")

// SALE OR AUTH TRANSACTION, OR ADD CUSTOMER/UPDATE CUSTOMER VAULT ACTIONS

& If ( transactiontype = "sale" or transactiontype = "auth" or customer_vault_action = "add_customer" or customer_vault_action = "update_customer" ;
"" & paymenttype & "" // REQUIRED

// FOR VAULT ACTIONS
& If ( customer_vault_action = "add_customer" or customer_vault_action = "update_customer" ; "" & customer_vault_action & ""; "")
& "" & customer_vault_id & ""

// INFO FOR CREDIT CARD TRANSACTION
& If ( paymenttype = "creditcard" ;
"" & ccnumber & ""
& "" & ccexpire & ""
& "" & cvv2 & ""
; "")

// INFO FOR CHECK (ACH) TRANSACTION
& If ( paymenttype = "check";
"" & checkname & ""
& "" & routing & ""
& "" & account & ""
& "" & accountholdertype & ""
& "" & accounttype & ""
& "" & seccode & ""
; "")


& "" & payment_plan_sku & "" // Used for recurring billing
& "" & amount & "" // REQUIRED
& "" & tax & "" // Informational Only
& "" & shipping & "" // Informational Only
& "" & description & ""
& "" & orderid & "" // Sent back in response, can be used to tie orders with transactions
& "" & ponumber & "" // Informational Only


// BILLING CONTACT INFO
& "" & firstname & ""
& "" & lastname & ""
& "" & company & ""
& "" & address1 & ""
& "" & address2 & ""
& "" & city & ""
& "" & state & ""
& "" & zip & ""
& "" & country & ""
& "" & phone & ""
& "" & fax & ""
& "" & email & ""
& "" & website & ""

// SHIPPING CONTACT INFO
& "" & shipfirstname & ""
& "" & shiplastname & ""
& "" & shipcompany & ""
& "" & shipaddress1 & ""
& "" & shipaddress2 & ""
& "" & shipcity & ""
& "" & shipstate & ""
& "" & shipzip & ""
& "" & shipcountry & ""
& "" & shipemail & ""

// OPTIONAL FEATURES
& "" & processorid & "" // If multiple merchant accounts are used within the gateway
& "" & descriptor & "" // Only supported by some processors
& "" & descriptorphone & "" // Only supported by some processors


; "")

A field should be created to hold the results as well. In our example, we call this field “results”

A script would then be created which would post the XML payload to the NELIX TransaX gateway. This should be setup to write the results to your “results” field:

// NOW WE POST THE XML STRING TO THE GATEWAY

TURL_Post("-unused"; "https://www.nelixtransax.com/roxapi/roxpost.asp"; "xml=" & TransaXDemo::xmlpayload)

If you are running Mac OS X, you will also need to run this calculation prior to the TURL_POST above:

// THIS STEP IS ONLY NEEDED ON MAC OS X. ALTHOUGH IT CAN BE LEFT IN FOR ANY OPERATING SYSTEM AND WILL NOT CAUSE PROBLEMS.

TURL_SetCustomHeader( "" ; "Content-Type: application/x-www-form-urlencoded" )


We then can use calculations to strip out the individual response values from the XML string that is returned as follows:

Status Code:

Middle ( results; Position (results; ""; 1; 1)+13; Position (results; "";1;1) - ( Position (results; ""; 1; 1)+13))

Status Message
Middle ( results; Position (results; ""; 1; 1)+12; Position (results; "";1;1) - ( Position (results; ""; 1; 1)+12))

Auth Code
Middle ( results; Position (results; ""; 1; 1)+11; Position (results; "";1;1) - ( Position (results; ""; 1; 1)+11))

Transaction ID
Middle ( results; Position (results; ""; 1; 1)+10; Position (results; "";1;1) - ( Position (results; ""; 1; 1)+10))

AVS Message
Middle ( results; Position (results; ""; 1; 1)+9; Position (results; "";1;1) - ( Position (results; ""; 1; 1)+9))

CVV2 Message
Middle ( results; Position (results; ""; 1; 1)+10; Position (results; "";1;1) - ( Position (results; ""; 1; 1)+10))

Order ID
Middle ( results; Position (results; ""; 1; 1)+9; Position (results; "";1;1) - ( Position (results; ""; 1; 1)+9))

Customer Vault ID
Middle ( results; Position (results; ""; 1; 1)+19; Position (results; "";1;1) - ( Position (results; ""; 1; 1)+19))


NOTE: In some cases, the TURL plug in will strip spaces from data passed into the gateway. If you experience this problem, you can replace your spaces with “%20”. These will be converted to spaces when they hit the gateway. This can be done for the First Name, Last Name, Company, Order Description, Address 1, Address 2 and City fields.


If you need any assistance with payment processing integration with your FileMaker Flash system, we are here to help!

Download FileMaker credit card and ACH (e-check) integration examples.



Comments

Popular posts from this blog

Virtual Terminal now supports EMV and NFC

Hosted Payment Pages: Customized, Mobilized, and QR Code'ized