All the provided examples use the Unix based tool "curl" and its syntax to mimic sending "POST"s and "GET"s as if you were using a browser from the command line. To test these examples yourself you may use any other tool of your preference in your own environment - including your browser. Windows users can download the cygwin toolset which gives a curl command line tool.
Please see the SCNet iPayBy Programmer Manual for more examples.
RESTful Capture Response
PHP RESTful Capture Example
RESTful Auth Request
RESTful Auth Response
RESTful Settle Previous Authorisation Request
RESTful Settle Previous Authorisation
RESTful Tokensised Capture/Refund
RESTful Login for query service REQUEST XML
RESTful Login for query service RESPONSE XML
RESTful Login token for query service REQUEST JSON
RESTful Login token for query service RESPONSE JSON
RESTful query previous capture JSON (use token)
RESTful Login for query service RESPONSE JSON
Check out a full working HTML AJAX example here
Check out a full working PHP example here
RESTful query previous capture XML (use token)
RESTful Login for query service RESPONSE XML
Please use the test URL endpoint: https://www.scnet.com.au/ipayby/ipaybyws
Please use the test URL endpoint: https://www.scnet.com.au/ipayby/ipaybyws
$params->arg0
= 'SCNet_Cert6'; //Merchant Id
$params->arg1 = 'testSCNet'; //password
$params->arg2 = '4444333322221111'; //Card Number
$params->arg3 = '1122'; //Expiry
$params->arg4 = '111'; //CVC
$params->arg5 = '12.00'; //Amount
$params->arg6 = 'Mr John Citizen'; //Cardholder optional
$params->arg7 = 'AUD'; //Currency
$params->arg8 = '100'; //InvoiceId optional
$client = new soapClient("https://www.scnet.com.au/ipayby/ipaybyws?WSDL",array('location' => 'https://www.scnet.com.au/ipayby/ipaybyws'));
$soap_response = $client->performTransaction($params);
print("\n<br><pre>");
print_r("The Transaction Summary is listed below....");
print("</pre><br>\n");
echo("\n<br><pre>");
echo("Order Number: " . $soap_response->return->orderNumber);
echo("<br>");
echo("Summary Response: " . $soap_response->return->summaryResponseCode);
echo("<br>");
echo("Response Code: " . $soap_response->return->responseCode);
echo("<br>");
echo("Response Text: " . $soap_response->return->responseText);
echo("<br>");
echo("Amount: " . $soap_response->return->amount);
echo("<br>");
echo("Auth ID: " . $soap_response->return->authId);
echo("<br>");
echo("RRN: " . $soap_response->return->RRN);
echo("<br>");
echo("Settlement Date: " . $soap_response->return->settlementDate);
echo("<br>");
echo("Transaction Type: " . $soap_response->return->transactionType);
echo("</pre><br>\n");
?>
Please use the test URL endpoint: https://www.scnet.com.au/ipayby/ipaybyws
if (response.@return.summaryResponseCode.Equals("Approved"))
{
_lblResult.Text = "Thank you. Your order has been submitted.
You will receive a confirmation email shortly.";
}
else if (response.@return.summaryResponseCode.Equals("Declined"))
{
if(response.@return.responseCode.Equals("51"))
{
_lblResult.Text = "Unfortunately your order was not
submitted due to insufficient funds.";
}
else if (response.@return.responseCode.Equals("33")
|| response.@return.responseCode.Equals("54"))
{
_lblResult.Text = "Unfortunately your order was not
submitted due to an expired credit card.";
}
else
{
_lblResult.Text = "Unfortunately your order was not
submitted due to an internal error. Please try again later.";
}
}
}
The XML document should be formatted like the below example: Note that invoiceid and adminemail must be populated.
<?xml version="1.0"?>
<PAYMENTREQUESTS>
<REQUEST>
<TYPE>Capture</TYPE>
<GATE>SCNet_Cert6</GATE>
<CCNUMBER>4444333322221111</CCNUMBER>
<CCEXPIRY>1111</CCEXPIRY>
<CCCVC>666</CCCVC>
<INVOICEID>266</INVOICEID>
<CURRENCY>AUD</CURRENCY>
<AMOUNT>20.00</AMOUNT>
<ADMINEMAIL>you@company.com.au</ADMINEMAIL>
</REQUEST>
</PAYMENTREQUESTS>
Note: Several payments can be performed at once.
The XML response from the servlet will be as such:
<PAYMENTRESPONSES>
<PAYMENTRESPONSE>
<RECEIPTNO>266-630086388279572</RECEIPTNO>
<SUMMARYCODE>Approved</SUMMARYCODE>
<RESPONSECODE>00</RESPONSECODE>
<RESPONSETEXT>Approved</RESPONSETEXT>
<AMOUNT>100</AMOUNT>
<RRN>FVrvIouVf3</RRN>
<SETTLEMENT_DATE>Mon Jun 30 00:00:00 WST 2008</SETTLEMENT_DATE>
<AUTHID>RMd0</AUTHID>
<TYPE>1</TYPE>
<XID>5383640</XID>
</PAYMENTRESPONSE>
</PAYMENTRESPONSES>
One of the biggest problems encountered when using AJAX (XMLDOM) is the cross site (domain) scripting problem - Firefox in particular will not allow it. This will always be a problem if you intend to never leave your site, but want to process the payment on our site. We have solved this problem for you by providing a unique solution involving a combination of XMLDOC and Javascript processing on our server. The following example illustrates this.
You can also create your own page using this example for testing, or contact us for more example code.
<HTML><h1>Example SCNet Payment Servlet AJAX
Call</h1>
<head>
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<script src="https://www.scnet.com.au/ipayby/psjs.js"></script>
<script>
function returnXML(xmldoc) {
alert("ReceiptNo " + xmldoc.getElementsByTagName('RECEIPTNO')[0].firstChild.data
+ "\nResponseCode " + xmldoc.getElementsByTagName('RESPONSECODE')[0].firstChild.data
+ "\nResponseText " + xmldoc.getElementsByTagName('RESPONSETEXT')[0].firstChild.data
+ "\nAmount " + xmldoc.getElementsByTagName('AMOUNT')[0].firstChild.data
+ "\nRRN " + xmldoc.getElementsByTagName('RRN')[0].firstChild.data
+ "\nSettlement_date " + xmldoc.getElementsByTagName('SETTLEMENT_DATE')[0].firstChild.data
+ "\nAuthID " + xmldoc.getElementsByTagName('AUTHID')[0].firstChild.data
+ "\nType " + xmldoc.getElementsByTagName('TYPE')[0].firstChild.data
+ "\nXID " + xmldoc.getElementsByTagName('XID')[0].firstChild.data
);
}
</script>
</head>
<body>
<input type="button" value="Click"
onClick="doPayment('amount=30.00&ccnumber=4444333322221111&ccexpiry=0807&cccvc=666&adminemail=you@some.com.au');">
</body>
</HTML>
This example provides an easy way to embed an DirectPost iFrame or Modal API payment page into your site.
All card details are taken on our secure page within your site.
You can also create your own page for testing using this example, or you can contact us for more sample code.
|
|