Aust. - ANZ / CBA / Westpac / NAB CFML Integrations

Would love to look at any DIRECT integration components or simple scripts for:

  • ANZ eGate
  • CBA
  • Westpac
  • NAB

that people have in cfml for credit card payments in AU.

Looking for DIRECT integration, not though a 3rd party gateway like eway/securePay, etc.

I’d be more than happy to contribute code back the community here… perhaps also even write some gateways for the cfpayment component also.

Otherwise might need to port something from OmniPay (Php lib)

ANZ eGate and CBA CommWeb use the MIGS (Mastercard) gateway. The interface to MIGS is simple, in essence:

<cfhttp url="https://migs.mastercard.com.au/vpcdps" timeout="40" method="post">
<cfhttpparam type="formfield" name="vpc_Version" value="1">
<cfhttpparam type="formfield" name="vpc_Merchant" value="#merchant#">
<cfhttpparam type="formfield" name="vpc_AccessCode" value="#accesscode#">
<cfhttpparam type="formfield" name="vpc_MerchTxnRef" value="#transaction#">
<cfhttpparam type="formfield" name="vpc_Amount" value="#abs(int(amount*100))#">
<cfif amount lt 0>
  <cfhttpparam type="formfield" name="vpc_Command" value="refund">
  <cfhttpparam type="formfield" name="vpc_TransNo" value="#refundtransaction#">
  <cfhttpparam type="formfield" name="vpc_User" value="#username#">
  <cfhttpparam type="formfield" name="vpc_Password" value="#password#">
<cfelse>
  <cfhttpparam type="formfield" name="vpc_Command" value="pay">
  <cfhttpparam type="formfield" name="vpc_OrderInfo" value="#payername#">
  <cfhttpparam type="formfield" name="vpc_CardNum" value="#cardnumber#">
  <cfhttpparam type="formfield" name="vpc_CardExp" value="#expiry#">
  <cfhttpparam type="formfield" name="vpc_CardSecurityCode" value="#ccv#">
</cfif>
</cfhttp>
<cfif cfhttp.statuscode neq "200 OK">
  Server did not respond
<cfelse>
  <cfset gateway=structnew()>
  <cfloop index="i" from="1" to="#listlen(cfhttp.filecontent,"&")#">
    <cfset gateway["#listfirst(listgetat(cfhttp.filecontent,i,"&"),"=")#"]=listlast(listgetat(cfhttp.filecontent,i,"&"),"=")>
  </cfloop>
  <cfif not structkeyexists(gateway,"vpc_TxnResponseCode") or not structkeyexists(gateway,"vpc_TransactionNo")>
    Server gave invalid response
  <cfelseif gateway["vpc_TxnResponseCode"] eq "0">
    Approved
  <cfelse>
    Declined
  </cfif>
</cfif>

Westpac use QValent for the PayWay REST API, which I haven’t worked with. NAB use SecurePay, which can use a script like the following:

<cfxml variable="input">
<NABTransactMessage>
  <MessageInfo>
    <messageID>#payment#</messageID>
    <messageTimestamp>#dateformat(now(),"yyyyddmm")##timeformat(now(),"HHmmss")#000000+#abs(GetTimeZoneInfo().UTCTotalOffset/60)#</messageTimestamp>
    <timeoutValue>30</timeoutValue>
    <apiVersion>xml-4.2</apiVersion>
  </MessageInfo>
  <MerchantInfo>
    <merchantID>#merchantid#</merchantID>
    <password>#password#</password>
  </MerchantInfo>
  <RequestType>Payment</RequestType>
  <Payment>
    <TxnList count="1">
      <Txn ID="1">
        <txnSource>23</txnSource>
        <amount>#round(abs(amount)*100)#</amount>
        <cfif amount lt 0>
          <purchaseOrderNo>#refund.payment#</purchaseOrderNo>
          <txnType>4</txnType>
          <txnID>#refundreference#</txnID>
        <cfelse>
          <purchaseOrderNo>#payment#</purchaseOrderNo>
          <txnType>0</txnType>
          <CreditCardInfo>
            <cardNumber>#cardnumber#</cardNumber>
            <expiryDate>#expiry#</expiryDate>
            <cvv>#ccv#</cvv>
          </CreditCardInfo>
        </cfif>
      </Txn>
    </TxnList>
  </Payment>
</NABTransactMessage>
</cfxml>
<cfhttp url="https://transact.nab.com.au/live/xmlapi/payment" method="post" timeout="45">
<cfhttpparam type="xml" value="#input#">
</cfhttp>
<cfif val(cfhttp.statuscode) neq "200">
  Server gave an invalid response
<cfelse>
  <cfset output=xmlparse(cfhttp.filecontent)>
  <cfset i=xmlsearch(output,"/NABTransactMessage/Status/statusCode")>
  <cfset j=xmlsearch(output,"/NABTransactMessage/Payment/TxnList/Txn/approved")>
  <cfset k=xmlsearch(output,"/NABTransactMessage/Payment/TxnList/Txn/responseText")>
  <cfset l=xmlsearch(output,"/NABTransactMessage/Payment/TxnList/Txn/txnID")>
  <cfset m=xmlsearch(output,"/NABTransactMessage/Status/statusDescription")>
  <cfif i[1].xmltext eq "515">
    Error
  <cfelseif i[1].xmltext neq "000">
    Error
  <cfelseif j[1].xmltext eq "Yes">
    Approved
  <cfelse>
    Declined
  </cfif>
</cfif>

Simon

2 Likes

Thanks for this.

Cheers.