Does anyone have any experience with integrating a Coldfusion website with Pay360? Basically our online shop needs to direct the user to a payment screen on Pay360 using the hosted cashier. The documentation is a bit vague but essentially we have to pass an API username and password, and json string to their request URL and they should return a response with a URL to a payment form. Should be straightforward using cfhttp but I get an error:
{“status”:”FAILED”,”reasonCode”:”exception.request.content”,”reasonMessage”:”Invalid request content: Unexpected character (‘/’ (code 47)): maybe a (non-standard) comment? (not recognized as one since Feature ‘ALLOW_COMMENTS’ not enabled for parser)”}
No one at Pay360 seems to be able to help. I’ve also tried using PHP (having only found one example on bronco.co.uk by doing a Google search) but that doesn’t work for me either.
This is my code. If anyone can give any advice (or has a working CF or PHP script that could point me in the right direction) that would be great, thanks!
<cfset variables.username = "xxxxxx">
<cfset variables.password = "xxxxxx">
<cfset stFields = {
"session": {
"preAuthCallback": {
"url": "http://www.example.com/callback/preAuth?status=SUSPEND",
"format": "REST_XML"
},
"returnUrl": {
"url": "http://www.example.com/transactionResult?MERCHANTREF=761585761585"
}
},
"transaction": {
"merchantReference": "761585761585",
"money": {
"amount": {
"fixed": 100
},
"currency": "GBP"
}
},
"customer": {
"identity": {
"merchantCustomerId": "1111111111111"
},
"details": {
"name": "given1 Family1",
"address": {
"line1": "matched",
"line2": "initialCustomer1AddresssLine2",
"city": "initalCustomer1City",
"region": "initalCustomer1Region",
"postcode": "AVS111",
"countryCode": "GBR"
},
"telephone": "0044111111111",
"emailAddress": "[email protected]",
"ipAddress": "1.1.1.1",
"defaultCurrency": "GBP"
}
},
"financialServices": {
"dateOfBirth": "19870818",
"surname": "Smith",
"accountNumber": "123ABC",
"postCode": "BS20"
}
}>
<cfhttp url="https://api.mite.pay360.com/hosted/rest/sessions/5309398/payments" method="post" username="#variables.username#" password="#variables.password#" result="httpResp" timeout="60">
<cfhttpparam type="header" name="Content-Type" value="application/json" />
<!--- failed attempt to pass username and password in the body
<cfhttpparam type="formField" name="username" value="#variables.username#">
<cfhttpparam type="formField" name="password" value="#variables.password#">--->
<cfhttpparam type="body" value="#serializeJSON(stFields)#">
</cfhttp>
<cfdump var="#httpResp#"/>