RESTful Web Services API

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 Request

curl -X POST -H "Content-Type: application/json" --data
" {\"merchantId\": \"SCNet_Cert6\"
, \"password\":\"testSCNet\"
, \"amount\" : \"300.00\"
, \"cardNumber\": \"4444333322221111\"
, \"expiryDate\" : \"1234\"
, \"currency\" : \"AUD\" }
" https://www.scnet.com.au/ipayby/rest/services/capture


RESTful Capture Response

{"results":[{"transactionType":"Capture"
,"settlementDate":"2015-07-15 00:00:00"
,"orderNumber":"150714095950607422"
,"amount":300.00
,"riskScore":"1 Low Risk"
,"xid":"379-P-IVCI5K0U"
,"responseText":"Approved or completed successfully"
,"summaryResponseCode":"Approved"
,"trxDate":"2015-07-14 09:59:51"
,"rrn":"379PIVCI5K0U"
,"authId":"570632"
,"responseCode":"00"}]}


PHP RESTful Capture Example

<?php $service_url = 'https://www.scnet.com.au/ipayby/rest/services/capture';
$curl = curl_init($service_url);
$curl_post_data = array( "merchantId" => 'SCNet_Cert6',
"password" => 'testSCNet',
"amount" => 500.00,
"cardNumber" => '4444333322221111',
"expiryDate" => '1234',
"cvc" => '123',
"currency" => 'AUD'
);
$curl_json = json_encode($curl_post_data);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, $curl_json);
curl_setopt($curl, CURLOPT_HTTPHEADER,
array('Content-Type:application/json')
);
$curl_response = curl_exec($curl);
curl_close($curl);

echo $curl_response;

?>



RESTful Auth Request

curl -X POST -H "Content-Type: application/json" --data
" {\"merchantId\": \"SCNet_Cert6\"
, \"password\":\"testSCNet\"
, \"amount\" : \"300.00\"
, \"cardNumber\": \"4444333322221111\"
, \"expiryDate\" : \"1234\"
, \"currency\" : \"AUD\" }
" https://www.scnet.com.au/ipayby/rest/services/auth


RESTful Auth Response

{"results":[{"transactionType":"Auth"
,"settlementDate":"2015-07-15 00:00:00"
,"orderNumber":"150714102159013079"
,"amount":300.00
,"riskScore":"1 Low Risk"
,"xid":"379-P-P33UVNVL"
,"responseText":"Approved or completed successfully"
,"summaryResponseCode":"Approved"
,"trxDate":"2015-07-14 10:22:28"
,"rrn":"379PP33UVNVL"
,"authId":"144690"
,"responseCode":"00"}]}



RESTful Settle Previous Authorisation Request

curl -X POST -H "Content-Type: application/json" --data
"{\"merchantId\": \"SCNet_Cert6\"
, \"password\":\"testSCNet\"
, \"amount\" : \"4.00\"
, \"authId\": \"144690\"
, \"orderNumber\" : \"150714102159013079\"}
" "https://www.scnet.com.au/ipayby/rest/services/settleauth


RESTful Settle Previous Authorisation

{"results":[{"responseCode":"00"
,"transactionType":"SettlementAdvice"
,"responseText":"Approved or completed successfully"
,"settlementDate":"2015-07-15 00:00:00"
,"orderNumber":"150714102159013079"
,"authId":"144690"
,"rrn":"379PP33UVNVL"
,"trxDate":"2015-07-14 11:07:29"
,"amount":300.00
,"xid":"379-P-P33UVNVL"
,"summaryResponseCode":"Approved"}]}



RESTful Tokensised Capture/Refund

curl -X POST -H "Content-Type: application/json" --data
"{\"merchantId\": \"SCNet_Cert6\"
, \"password\":\"testSCNet\"
, \"amount\" : \"4.00\"
, \"orderNumber\" : \"150714102159013079\"
, \"transactionType\" : \"Capture\"
, \"invoiceId\" : \"999\"}
" https://www.scnet.com.au/ipayby/rest/services/ordercapture



RESTful Login for query service REQUEST XML

curl -X POST --data "merchantId=SCNet_Cert6&password=testSCNet" https://www.scnet.com.au/ipayby/rest/services/login


RESTful Login for query service RESPONSE XML

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<login>
<token>SDFSDFTY4MzgxNTU1ODk4MADFDEREDXDSF</token>
</login>



RESTful Login token for query service REQUEST JSON

curl -X POST --data "merchantId=SCNet_Cert6&password=testSCNet" https://www.scnet.com.au/ipayby/rest/services/login.json


RESTful Login token for query service RESPONSE JSON

{"login":["SDFSDFSDFTg2OTY4Njg0NDkyNTM2MA"]}


RESTful query previous capture JSON (use token)

https://www.scnet.com.au/ipayby/rest/services/queryj/SCNet_Cert6/150714102159013079/?token=OTg2OTYzNDI4MTg1MzY1Ng


RESTful Login for query service RESPONSE JSON

Check out a full working HTML AJAX example here

Check out a full working PHP example here

{"results":[{"transactionType":"Auth"
,"settlementDate":"2015-07-15 00:00:00"
,"orderNumber":"150714102159013079"
,"amount":300.00,"phone":""
,"mobile":"","street":""
,"cardNumber":"444433#######111"
,"riskScore":"1 Low Risk"
,"xid":"379-P-P33UVNVL"
,"responseText":"Approved or completed successfully"
,"summaryResponseCode":"Approved"
,"trxDate":"2015-07-14 10:22:28"
,"ipAddress":"192.168.0.1"
,"rrn":"379PP33UVNVL"
,"authId":"144690"
,"expiryDate":"1234"
,"currency":"AUD","responseCode":"00"}]}



RESTful query previous capture XML (use token)

https://www.scnet.com.au/ipayby/rest/services/queryx/SCNet_Cert6/150714102159013079/?token=OTg2OTYzNDI4MTg1MzY1Ng


RESTful Login for query service RESPONSE XML

<result>
<transaction>
<amount>300.00</amount>
<authId>144690</authId>
<cardNumber>444433#######111</cardNumber>
<currency>AUD</currency>
<expiryDate>1234</expiryDate>
<ipAddress>192.168.0.252</ipAddress>
<mobile/>
<orderNumber>150714102159013079</orderNumber>
<phone/>
<RRN>379PP33UVNVL</RRN>
<responseCode>00 <responseText>Approved or completed successfully</responseText>
<riskScore>1 Low Risk</riskScore>
<settlementDate>2015-07-15T00:00:00+08:00</settlementDate>
<street/>
<summaryResponseCode>Approved</summaryResponseCode>
<transactionType>Auth</transactionType>
<trxDate>2015-07-14T10:22:28+08:00</trxDate>
<XID>379-P-P33UVNVL</XID>
</transaction>
</result>

Web Service API

Please use the test URL endpoint: https://www.scnet.com.au/ipayby/ipaybyws

<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://service.ipay.scnet/">
<env:Header/>
<env:Body>
<ns1:performTransaction>
<arg0>SCNet_Cert6</arg0>
<arg1>testSCNet</arg1>
<arg2>4444333322221111</arg2>
<arg3>1111</arg3>
<arg4>666</arg4>
<arg5>99.00</arg5>
<arg6>Mr. John Citizen</arg6>
<arg7>AUD</arg7>
<arg8>123</arg8>
</ns1:performTransaction>
</env:Body>
</env:Envelope>

PHP SOAP API

Please use the test URL endpoint: https://www.scnet.com.au/ipayby/ipaybyws

//PHP SOAP enabled call to the Payment Gateway

$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");
?>

.NET API CALL

Please use the test URL endpoint: https://www.scnet.com.au/ipayby/ipaybyws

protected void btnSubmit_Click(object sender, EventArgs e)
{
au.com.scnet.www.IpayByWS ipayByWS = new au.com.scnet.www.IpayByWS();
au.com.scnet.www.performTransaction performTransactionDetails = new au.com.scnet.www.performTransaction();
performTransactionDetails.arg0 = "SCNet_Cert6";
performTransactionDetails.arg1 = "testSCNet";
performTransactionDetails.arg2 = "4444333322221111";
performTransactionDetails.arg3 = "1111";
performTransactionDetails.arg4 = "666";
performTransactionDetails.arg5 = Convert.ToDecimal("12.00");
performTransactionDetails.arg5Specified = true;
performTransactionDetails.arg6 = "Mr John Citizen";
performTransactionDetails.arg7 = "AUD";
performTransactionDetails.arg8 = "1234567";
performTransactionDetails.arg9 = "Joe.Bloggs@company.com";
performTransactionDetails.arg10 = "John.Citizen@personalmail.com";
performTransactionDetails.arg11 = "Purchase of Sporting Equipment";
performTransactionDetails.arg12 = "2 x Golf Balls, 3 x tennis racquets”;
performTransactionDetails.arg13 = "John Citizen”;
performTransactionDetails.arg14 = "123 Smith St, Lygon";
performTransactionDetails.arg15 = "North Shore";
performTransactionDetails.arg17 = "234234234";
au.com.scnet.www.performTransactionResponse response = ipayByWS.performTransaction(performTransactionDetails);

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.";
}
}
}

XML API

The Demo URL is: https://www.scnet.com.au/ipayby/PaymentServletXML

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>

Direct Post/AJAX API

Please use the test code below

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>

DirectPost iFrame or Modal API

Please use the test code below

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.

You can provide a "Click to Pay" button

Please use test card 4444333322221111 any expiry and any CVV


 

Oracle Database PL/SQL RESTful API

You will need to setup an Oracle Wallet and import the necessary certificates into the database. Please read the Oracle Documentation for further information. More examples in our online documentation.

declare
l_req utl_http.req;
l_res utl_http.resp;
l_url varchar2(4000) := 'https://www.scnet.com.au/ipayby/rest/services/capture';
l_name varchar2(4000);
l_buffer varchar2(4000);
l_clob clob;
l_content varchar2(4000) := '{"merchantId": "SCNet_Cert6"
, "password" : "testSCNet"
, "amount" : "300.00"
, "cardNumber" : "4444333322221111"
, "expiryDate" : "1234"
, "currency" : "AUD"}';
begin
utl_http.set_wallet('file:path_to_wallet');
l_req := utl_http.begin_request(l_url, 'POST',' HTTP/1.1');
utl_http.set_header(l_req, 'user-agent', 'mozilla/4.0');
utl_http.set_header(l_req, 'content-type', 'application/json');
utl_http.set_header(l_req, 'Content-Length', length(l_content));
utl_http.write_text(l_req, l_content);
l_res := utl_http.get_response(l_req);
-- process the response from the HTTP call
begin
loop
utl_http.read_line(l_res, l_buffer);
dbms_output.put_line(l_buffer);
l_clob := l_clob || l_buffer;
end loop;
utl_http.end_response(l_res);
exception
when utl_http.end_of_body
then
utl_http.end_response(l_res);
end;