Created
August 28, 2013 06:33
-
-
Save Leask/6362756 to your computer and use it in GitHub Desktop.
A PayPal DPS example in ASP
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <%@ Language=VBScript %> | |
| <% | |
| sXmlAction = sXmlAction & "<GenerateRequest>" | |
| sXmlAction = sXmlAction & "<PxPayUserId>TestAccount</PxPayUserId>" | |
| sXmlAction = sXmlAction & "<PxPayKey>ae4268ddc0bf1744d48f93f317bb5c23b444cbada22ecff3fae62d566e152595</PxPayKey>" | |
| sXmlAction = sXmlAction & "<TxnType>Purchase</TxnType>" | |
| sXmlAction = sXmlAction & "<CurrencyInput>NZD</CurrencyInput>" | |
| sXmlAction = sXmlAction & "<AmountInput>2.03</AmountInput>" | |
| sXmlAction = sXmlAction & "<MerchantReference>Test Transaction</MerchantReference>" | |
| sXmlAction = sXmlAction & "<EmailAddress>Test@test.com</EmailAddress>" | |
| sXmlAction = sXmlAction & "<UrlSuccess>http://www.mywebsite.com/response.asp</UrlSuccess>" | |
| sXmlAction = sXmlAction & "<UrlFail>http://www.mywebsite.com/response.asp</UrlFail>" | |
| sXmlAction = sXmlAction & "</GenerateRequest>" | |
| Dim objXMLhttp | |
| Set objXMLhttp = server.Createobject("MSXML2.XMLHTTP") | |
| objXMLhttp.Open "POST", "https://www.paymentexpress.com/pxpay/pxaccess.aspx" ,False | |
| objXMLhttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded" | |
| objXMLhttp.send sXmlAction | |
| Dim oXML, URI | |
| Set oXML = Server.CreateObject("MSXML2.DomDocument") | |
| oXML.loadXML(objXMLhttp.responseText) | |
| URI = oXML.selectSingleNode("//URI").text | |
| Response.Redirect URI | |
| Set objXMLhttp = nothing | |
| %> | |
| Response: | |
| <%@ Language=VBScript %> | |
| <% | |
| dim Result | |
| Result = Request.QueryString ("result") | |
| sXmlAction = sXmlAction & "<ProcessResponse>" | |
| sXmlAction = sXmlAction & "<PxPayUserId>TestAccount</PxPayUserId>" | |
| sXmlAction = sXmlAction & "<PxPayKey>ae4268ddc0bf1744d48f93f317bb5c23b444cbada22ecff3fae62d566e152595</PxPayKey>" | |
| sXmlAction = sXmlAction & "<Response>" & Result &"</Response>" | |
| sXmlAction = sXmlAction & "</ProcessResponse>" | |
| Dim objXMLhttp | |
| Set objXMLhttp = server.Createobject("MSXML2.XMLHTTP") | |
| objXMLhttp.Open "POST", "https://www.paymentexpress.com/pxpay/pxaccess.aspx" ,False | |
| objXMLhttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded" | |
| objXMLhttp.send sXmlAction | |
| response.write objXMLhttp.responsetext | |
| Set objXMLhttp = nothing | |
| %> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment