POLi is the online payment option that allows you to use your internet banking to securely pay for goods and services for Australian and New Zealand banks in three easy steps.
- Select POLi to make a payment
- Log in to your bank and select preferred account
- Confirm your payment
Note that POLi does not store any sensitive information such as internet banking usernames and passwords in their records.
To implement or use POLi there are three different methods like Web Services, Poli Link, API functions. Please find below how you can integrate Web service in your online website to accept payment using POLi.
Web Service
To receive payment using POLi web services there are two steps first you need to initiate the transaction which will create a token on runtime to track the payment and status on server. Second, you need to get the transaction done after selecting the bank and doing the transaction through that.
Initiate Transactions
To initiate a transaction for a customer you need to call Initiate Transaction on the POLi API.
You need to provide: your merchant code and authentication code to identify yourself, and the transaction details.
Your private merchant code and authentication code
Amount– the full transaction amount the customer should be charged
CurrencyCode – The currency of the transaction (note, this must match the currency of your merchant account)
MerchantHomepageURL – the full merchant URL is displayed in the merchant information on the POLi landing page.
SuccessURL – full URL to redirect the customer to if the transaction is successful
FailureURL– full URL to redirect the customer to if the transaction is not successful
CancellationURL– full URL used to redirect the customer to if they cancel the transaction.
NotificationURL – full URL where to make the Nudge call to. see What is the POLi Nudge?.
SelectedFICode– Used for pre-selecting banks in order to skip the POLi Landing page
Note: you also need to upload ca-bundle.crt file on your server to make curl work smoothly. You can search google to get the same. Should be placed on root folder of website.
<?php
$json_builder = ‘{
“Amount”:”1.2″,
“CurrencyCode”:”AUD”,
“MerchantReference“:”CustomerRef12345”,
“MerchantHomepageURL”:”https://www.mycompany.com”,
“SuccessURL”:”https://www.mycompany.com/Success”,
“FailureURL”:”https://www.mycompany.com/Failure”,
“CancellationURL”:”https://www.mycompany.com/Cancelled”,
“NotificationURL”:”https://www.mycompany.com/nudge”
}’;
$auth = base64_encode(‘S61xxxxx:AuthCode123‘);
$header = array();
$header[] = ‘Content-Type: application/json’;
$header[] = ‘Authorization: Basic ‘.$auth;
$ch = curl_init(“https://poliapi.apac.paywithpoli.com/api/v2/Transaction/Initiate”);
//See the cURL documentation for more information: http://curl.haxx.se/docs/sslcerts.html
//We recommend using this bundle: https://raw.githubusercontent.com/bagder/ca-bundle/master/ca-bundle.crt
curl_setopt( $ch, CURLOPT_CAINFO, “ca-bundle.crt“);
curl_setopt( $ch, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1_2);
curl_setopt( $ch, CURLOPT_HTTPHEADER, $header);
curl_setopt( $ch, CURLOPT_HEADER, 0);
curl_setopt( $ch, CURLOPT_POST, 1);
curl_setopt( $ch, CURLOPT_POSTFIELDS, $json_builder);
curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, 0);
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec( $ch );
curl_close ($ch);
$json = json_decode($response, true);
header(‘Location: ‘.$json[“NavigateURL”]);
?>
GetTransaction
<?php
$token = $_POST[“Token”];
if(is_null($token)) {
$token = $_GET[“token”];
}
$auth = base64_encode(‘S61xxxxx:AuthCode1234‘);
$header = array();
$header[] = ‘Authorization: Basic ‘.$auth;
$ch = curl_init(“https://poliapi.apac.paywithpoli.com/api/v2/Transaction/GetTransaction?token=”.urlencode($token));
//See the cURL documentation for more information: http://curl.haxx.se/docs/sslcerts.html
//We recommend using this bundle: https://raw.githubusercontent.com/bagder/ca-bundle/master/ca-bundle.crt
curl_setopt( $ch, CURLOPT_CAINFO, “ca-bundle.crt“);
curl_setopt( $ch, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1_2);
curl_setopt( $ch, CURLOPT_HTTPHEADER, $header);
curl_setopt( $ch, CURLOPT_HEADER, 0);
curl_setopt( $ch, CURLOPT_POST, 0);
curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, 0);
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec( $ch );
curl_close ($ch);
$json = json_decode($response, true);
print_r($json);
?>
You can check the list of error message in case of failed request on below link.
Leave a Reply