How To: Credit Card Processing with Microsoft Access

This is the first 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 Microsoft Access 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


Option Compare Database

Function BuilXMLString()
Dim vString
vString = ""

vString = vString & "" & Me.transactiontype & ""
vString = vString & "" & Me.username & ""
vString = vString & "" & Me.Password & ""

vString = vString & "" & Me.merchantdefined1 & ""
vString = vString & "" & Me.merchantdefined2 & ""

If Me.transactiontype = "void" Then
vString = vString & "" & Me.transid & ""
If Me.paymenttype = "check" Then
vString = vString & "" & Me.paymenttype & ""
End If
End If

If Me.transactiontype = "refund" Then
vString = vString & "" & Me.amount & ""
vString = vString & "" & Me.transid & ""
If Me.paymenttype = "check" Then
vString = vString & "" & Me.paymenttype & ""
End If
End If

If Me.transactiontype = "capture" Then
vString = vString & "" & Me.amount & ""
vString = vString & "" & Me.transid & ""
vString = vString & "" & Me.orderid & ""
vString = vString & "" & Me.tracking_number & ""
vString = vString & "" & Me.shipping_carrier & ""
If Me.paymenttype = "check" Then
vString = vString & "" & Me.paymenttype & ""
End If
End If

If Me.transactiontype = "update" Then
vString = vString & "" & Me.transid & ""
vString = vString & "" & Me.tracking_number & ""
vString = vString & "" & Me.shipping_carrier & ""
If Me.paymenttype = "check" Then
vString = vString & "" & Me.paymenttype & ""
End If
End If

If Me.customer_vault_action = "delete_customer" Then
vString = vString & "" & Me.customer_vault_action &
"
" & Me.customer_vault_id & ""
End If

If Me.transactiontype = "sale" Or Me.transactiontype = "auth" Or Me.customer_vault_action = "add_customer" Or
Me.customer_vault_action = "update_customer" Then
vString = vString & "" & Me.paymenttype & ""

If Me.customer_vault_action = "add_customer" Or Me.customer_vault_action = "update_customer" Then
vString = vString & "" & Me.customer_vault_action & ""
End If
vString = vString & "" & Me.customer_vault_id & ""

If Me.paymenttype = "creditcard" Then
vString = vString & "" & Me.ccnumber & ""
vString = vString & "" & Me.ccexpire & ""
vString = vString & "" & Me.cvv2 & ""
End If
If Me.paymenttype = "check" Then
vString = vString & "" & Me.checkname & ""
vString = vString & "" & Me.routing & ""
vString = vString & "" & Me.account & ""
vString = vString & "" & Me.accountholdertype & ""
vString = vString & "" & Me.accounttype & ""
vString = vString & "" & Me.seccode & ""
End If

vString = vString & "" & Me.payment_plan_sku & ""

vString = vString & "" & Me.amount & ""
vString = vString & "" & Me.tax & ""
vString = vString & "" & Me.shipping & ""
vString = vString & "" & Me.description & ""
vString = vString & "" & Me.orderid & ""
vString = vString & "" & Me.ponumber & ""

vString = vString & "" & Me.firstname & ""
vString = vString & "" & Me.lastname & ""
vString = vString & "" & Me.company & ""
vString = vString & "" & Me.address1 & ""
vString = vString & "" & Me.address2 & ""
vString = vString & "" & Me.city & ""
vString = vString & "" & Me.state & ""
vString = vString & "" & Me.zip & ""
vString = vString & "" & Me.country & ""
vString = vString & "" & Me.phone & ""
vString = vString & "" & Me.fax & ""
vString = vString & "" & Me.email & ""
vString = vString & "" & Me.website & ""

vString = vString & "" & Me.shipfirstname & ""
vString = vString & "" & Me.shiplastname & ""
vString = vString & "" & Me.shipcompany & ""
vString = vString & "" & Me.shipaddress1 & ""
vString = vString & "" & Me.shipaddress2 & ""
vString = vString & "" & Me.shipcity & ""
vString = vString & "" & Me.shipstate & ""
vString = vString & "" & Me.shipzip & ""
vString = vString & "" & Me.shipcountry & ""
vString = vString & "" & Me.shipemail & ""

vString = vString & "" & Me.processorid & ""
vString = vString & "" & Me.descriptor & ""
vString = vString & "" & Me.descriptorphone & ""
End If

BuilXMLString = vString
End Function

Function SoapWrapper(vXML)
Dim S As String

S = ""
S = S & ""
S = S & ""
S = S & "" & vXML & "
"

SoapWrapper = S
End Function

Private Sub Command1_Click()
Dim vXML, Results, ResultHeaders

vXML = SoapWrapper(BuilXMLString())

Dim O As New MSXML2.XMLHTTP30

O.Open "POST", "https://www.nelixtransax.com/roxapi/rox.asmx", False
O.setRequestHeader "Content-Type", "text/xml"
O.setRequestHeader "Connection", "close"
O.setRequestHeader "SOAPAction", "https://www.nelixtransax.com/roxapi/ProcessTransaction"
O.send vXML

Dim xmlDoc As New MSXML2.DOMDocument30
xmlDoc.loadXML (O.responseXML.XML)

Set oNode = xmlDoc.childNodes(1).childNodes(0).childNodes(0).childNodes(0)
Results = ""

On Error Resume Next

Results = Results & "STATUS_CODE: " & oNode.selectSingleNode("STATUS_CODE").Text & vbCrLf
Results = Results & "STATUS_MSG: " & oNode.selectSingleNode("STATUS_MSG").Text & vbCrLf
Results = Results & "TRANS_ID: " & oNode.selectSingleNode("TRANS_ID").Text & vbCrLf
Results = Results & "AUTH_CODE: " & oNode.selectSingleNode("AUTH_CODE").Text & vbCrLf
Results = Results & "AVS_CODE: " & oNode.selectSingleNode("AVS_CODE").Text & vbCrLf
Results = Results & "AVS_MSG: " & oNode.selectSingleNode("AVS_MSG").Text & vbCrLf
Results = Results & "CVV2_CODE: " & oNode.selectSingleNode("CVV2_CODE").Text & vbCrLf
Results = Results & "CVV2_MSG: " & oNode.selectSingleNode("CVV2_MSG").Text & vbCrLf
Results = Results & "ORDERID: " & oNode.selectSingleNode("ORDERID").Text & vbCrLf
Results = Results & "CUSTOMER_VAULT_ID: " & oNode.selectSingleNode("CUSTOMER_VAULT_ID").Text & vbCrLf

Me.Text2 = Results
End Sub

If you need any assistance with payment processing integration with your Microsoft Access database, we are here to help!

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

Comments

That’s really great,payment services to its customers helping them adapt and excel in the ever changing card payment market.Highly recommended.

Popular posts from this blog

Merchant Account Cancellation Fees

Flexible Pricing Controls