ASP Programming Example

The following code is an example of a cnpAPI Authorization transaction submitted via HTTPS Post using ASP.

Dim xml

  Dim strXML

  strXML = strXML & "<cnpOnlineRequest version=""12.0"" xmlns=""http://www.vantivcnp.com/schema""merchantId=""MERCHANTID"">"

    strXML = strXML & "<authentication>"

    strXML = strXML & "<user>USERNAME</user>"

    strXML = strXML & "<password>########</password>"

    strXML = strXML & "</authentication>"

    strXML = strXML & "<authorization id=""834262"" reportGroup=""123"" customerId=""038945"">"

    strXML = strXML & "<orderId>3235059</orderId>"

    strXML = strXML & "<amount>54399</amount>"

    strXML = strXML & "<orderSource>ecommerce</orderSource>"

      strXML = strXML & "<billToAddress>"

        strXML = strXML & "<name>Todd Wilson</name>"

        strXML = strXML & "<addressLine1>123 Blue Street</addressLine1>"

        strXML = strXML & "<addressLine2>Suite 108</addressLine2>"

        strXML = strXML & "<addressLine3>Address Line 3</addressLine3>"

        strXML = strXML & "<city>Lowell</city>"

        strXML = strXML & "<state>MA</state>"

        strXML = strXML & "<zip>01851</zip>"

        strXML = strXML & "<country>USA</country>"

        strXML = strXML & "<email>twilson@email.com</email>"

        strXML = strXML & "<phone>323-222-2222</phone>"

      strXML = strXML & "</billToAddress>"

      strXML = strXML & "<card>"

        strXML = strXML & "<type>VI</type>"

        strXML = strXML & "<number>#############</number>"

        strXML = strXML & "<expDate>0521</expDate>"

        strXML = strXML & "<cardValidationNum>###</cardValidationNum>"

      strXML = strXML & "</card>"

    strXML = strXML & "</authorization>"

  strXML = strXML & "</cnpOnlineRequest>"

set xml = CreateObject("Microsoft.XMLHTTP")

xml.setRequestHeader "Content-type", "text/xml; charset=UTF-8"

xml.Open "POST", "https://site.info.com/from_Vantiv", False

xml.Send strXML

Response.write (xml.responseText)

set xml = Nothing