GETTransaction API


When a valid transaction token is provided in the GETTransaction API call, all the details about the payment are returned to the merchants system.

Common scenarios where GETTransaction web service is called are when a merchant is:

  • Responding to a POLi nudge
  • Enquiring due to approaching timeout
  • Enquiring due to expired POLi timeout period
  • Recovering after breakdown in communications with POLi

POLi API Workflow



GETTransaction Request


To formulate a GETTransaction call, you must append the token to the query string like so:

https://poliapi.apac.paywithpoli.com/api/v2/Transaction/GetTransaction?token={transactionToken}

GETTransaction Response


Name Description Data Type JSON Data Type Possible Values
TransactionRefNo The POLi ID associated with the transaction String String A unique 12 digit reference to a POLi transaction
CurrencyCode The currency of the transaction

Note:This must match the currency of your merchant account

String String Possible values are aligned with ISO Standard ISO 4217
CountryName The plain text name of the country the transaction String String
CountryCode The code of the country where the transaction takes place String String Possible values are aligned with ISO Standard ISO 3166-1
PaymentAmount The Amount of the transaction Decimal.Value upto 2 decimal places. Number Attempted payment amount
AmountPaid The actual amount paid for the transaction Decimal.Value upto 2 decimal places. Number Actual paid amount
EstablishedDateTime The date and time of the POLi server when the InitiateTransaction request was received Datetime String
MerchantEstablishedDateTime The date and time in the entity's timezone that the transaction was established Datetime String
StartDateTime The date and time the transaction was started Datetime String
EndDateTime The date and time the transaction ended Datetime String
BankReceipt The Internet banking receipt number provided from the banks receipt page String String
BankReceiptDateTime The date and time of the bank receipt String String
TransactionStatusCode A code that indicates the terminal status of the transaction String String See Transaction Status
ErrorCode An error code associated with the transaction, if any String String See Error Codes
ErrorMessage A description of the error associated with the transaction, if any String String See Error Codes
FinancialInstitutionCode The code of the financial institution the payment was made from String String
FinancialInstitutionCountryCode The code of the financial institution and country the payment was made from String String
FinancialInstitutionName The name of the financial institution the payment was made from String String
MerchantReference The merchant reference passed in the InitiateTransaction request String String
MerchantData The merchant data that was passed in the InitiateTransaction request for round trip purposes String String
MerchantAccountName The merchant’s bank account name where the funds were to be paid String String
MerchantAccountSortCode The merchant’s account sort code where the funds were to be paid.
Australia: This is the BSB number.
New Zealand: This is the Bank and Branch codes respectively.
String String
MerchantAccountSuffix The merchant’s account suffix where the funds were to be paid. Note: This is only applicable to New Zealand merchants String String 000
MerchantAccountNumber The merchant’s account number where the funds were to be paid String String
PayerFirstName The first name of the user who paid (if available) String String
PayerFamilyName The last name of the user who paid (if available) String String
PayerAccountSortCode The payer’s account sort code where the funds were to be paid.
Australia: This is the BSB number.
New Zealand: This is the Bank and Branch codes respectively.
String String
PayerAccountNumber The account number of the user who paid (if available) String String
PayerAccountSuffix The suffix of the user who paid (if available)
Note: This is only applicable to New Zealand merchants
String String


GETTransaction Example


Below is an example nudge page: It receives the Token as post data, and then uses it to call GETTransaction.
Download our API collection to generate code snippets of your preferred language

                                
$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);
                    
                                
var token = Request.Form["Token"];
if (String.IsNullOrEmpty(token)) { token = Request.QueryString["token"]; }
 
var auth = 
    System.Convert.ToBase64String
    (System.Text.Encoding.UTF8.GetBytes('S61xxxxx:AuthCode12345'));
 
var myRequest = 
    System.Net.WebRequest.Create
    ("https://poliapi.apac.paywithpoli.com/api/v2/Transaction/GetTransaction?token="+HttpUtility.UrlEncode(token));
myRequest.Method = "GET";
myRequest.Headers.Add("Authorization", "Basic "+auth);
 
var response = (System.Net.HttpWebResponse)myRequest.GetResponse();
var data = response.GetResponseStream();
var streamRead = new StreamReader(data);
Char[] readBuff = new Char[response.ContentLength];
int count = streamRead.Read(readBuff, 0, (int)response.ContentLength);
while (count > 0)
{
    var outputData = new String(readBuff, 0, count);
    Console.Write(outputData);
    count = streamRead.Read(readBuff, 0, (int)response.ContentLength);
    dynamic latest = JsonConvert.DeserializeObject(outputData);
    ViewBag.Data = latest["TransactionRefNo"];
}
response.Close();
data.Close();
streamRead.Close();
                        
                    
                                
import java.io.*;
import java.net.*;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLEncoder;
import java.util.Base64;


public class POLiGetTransaction 
{ 
    public static void main(String[] args) {
        SendPoliGetTransactionRequest();
    }

    
    public static void SendPoliGetTransactionRequest()
    {
    	try{
    		
    	    String token = "xSlaOhIxgB93I7TnGngbEi%2bXARooXQBw";//Obtained from Initiate Transaction request 
            String query = "https://poliapi.apac.paywithpoli.com/api/v2/Transaction/GetTransaction?token=" +token;
               
            URL url = new URL(query);
            HttpURLConnection conn = (HttpURLConnection) url.openConnection();
            conn.setConnectTimeout(5000);
            
            String accesscode  = "S61xxxxx:AuthCode12345"; //ADD YOUR OWN CREDENTIALS 
            String encodedAuthString = Base64.getEncoder().encodeToString(accesscode.getBytes());
            
            conn.setRequestProperty("authorization", "Basic " + encodedAuthString); 
     
            conn.setDoOutput(true);
            conn.setDoInput(true);
            conn.setRequestMethod("GET");

            // read the response
           InputStream in = new BufferedInputStream(conn.getInputStream());
           
           byte[] contents = new byte[1024];
           int bytesRead = 0;
           
           String poliResponse = ""; 
           
            while((bytesRead = in.read(contents)) != -1)
            { 
              poliResponse += new String(contents, 0, bytesRead);              
            }
            
         
            System.out.print(poliResponse);
    
           in.close();
           conn.disconnect();
     
        }
        catch(IOException ex)
        {
        	System.out.print(ex);
        }
    }
}
                             
                             

GETTransaction Response Example



{
    "CountryName": "Australia",
    "FinancialInstitutionCountryCode": "",
    "TransactionID": "9c9955a7-53d1-4a33-b076-c53435e00225",
    "MerchantEstablishedDateTime": "2018-02-27T15:19:54.973",
    "PayerAccountNumber": "",
    "PayerAccountSortCode": "",
    "MerchantAccountSortCode": "923100",
    "MerchantAccountName": "TEST",
    "MerchantData": "MyDefinedData",
    "CurrencyName": "Australian Dollar",
    "TransactionStatus": "EulaAccepted",
    "IsExpired": false,
    "MerchantEntityID": "e04dc5a4-8cf9-4af0-98df-669f3bb05aab",
    "UserIPAddress": "127.0.0.1",
    "POLiVersionCode": "  ",
    "MerchantName": "Pricebuster AU",
    "TransactionRefNo": "996108109898",
    "CurrencyCode": "AUD",
    "CountryCode": "AU",
    "PaymentAmount": 1.27,
    "AmountPaid": 0,
    "EstablishedDateTime": "2018-02-27T15:19:55.063",
    "StartDateTime": "2018-02-27T15:19:55.063",
    "EndDateTime": null,
    "BankReceipt": "",
    "BankReceiptDateTime": "",
    "TransactionStatusCode": "EulaAccepted",
    "ErrorCode": null,
    "ErrorMessage": "",
    "FinancialInstitutionCode": "",
    "FinancialInstitutionName": "",
    "MerchantReference": "MyRef01",
    "MerchantAccountSuffix": null,
    "MerchantAccountNumber": "35313843",
    "PayerFirstName": "",
    "PayerFamilyName": "",
    "PayerAccountSuffix": ""
}