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

Initiate Transaction API Call

Your customer completes the payment and is redirected back

Nudge sent to Notification URL

POLi POSTS a Nudge to your Notification URL unpon transaction reaching a final state

GET Transaction API Call

You call the GET Transaction and direct the customer to the appropriate page

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 up to 2 decimal places
Number Attempted payment amount
AmountPaid The actual amount paid for the transaction Decimal
Value up to 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. 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. 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) String String
TransactionID The unique transaction ID which is used internally String String A unique 32 hexadecimal digit reference UUID / GUID to a POLi transaction
CurrencyName The plain text name of the transaction currency String String Possible values are aligned with ISO Standard ISO 4217
IsExpired The status that indicates if the the POLi link for the transaction has expired Boolean Boolean
MerchantEntityID The unique Merchant Entity ID related to the transaction which is used internally String String A unique 32 hexadecimal digit reference UUID / GUID to a POLi Merchant
UserIPAddress The IP address that the consumer initiated the transaction String String
POLiVersionCode The vector version which was used to complete the transaction String String
MerchantName The merchant name passed in the InitiateTransaction request String String

GETTransaction Example

Below is an example nudge page: It receives the Token as post data, and then uses it to call GETTransaction.

Visit API Introduction to generate code snippets of your preferred language.

PHP

$token = $_POST["Token"];
if(is_null($token)) {
    $token = $_GET["token"];
}

 $auth = base64_encode('SS64xxxxx:AuthCode1234'); //ADD YOUR CREDENTIALS
 $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);

C Sharp


var token = Request.Form["Token"];
if (String.IsNullOrEmpty(token)) { token = Request.QueryString["token"]; }

var auth = 
    System.Convert.ToBase64String
    (System.Text.Encoding.UTF8.GetBytes('SS64xxxxx:AuthCode1234')); //ADD YOUR CREDENTIALS

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();

Java

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 InitiateTransaction 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  = "SS64xxxxx:AuthCode1234"; //ADD YOUR 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

Json

{
    "CountryName": "New Zealand",
    "FinancialInstitutionCountryCode": "iBankNZ01",
    "TransactionID": "dc379909-dd6c-4df9-9531-3cca62412cc1",
    "MerchantEstablishedDateTime": "2023-09-27T06:31:16.547",
    "PayerAccountNumber": "0054321",
    "PayerAccountSortCode": "121234",
    "MerchantAccountSortCode": "020700",
    "MerchantAccountName": "TEST",
    "MerchantData": "",
    "CurrencyName": "New Zealand Dollar",
    "TransactionStatus": "Completed",
    "IsExpired": false,
    "MerchantEntityID": "48a43e17-3f22-462a-95a4-0e5391fc1614",
    "UserIPAddress": "127.0.0.0",
    "POLiVersionCode": "4 ",
    "MerchantName": "Your Company Name",
    "TransactionRefNo": "996512345678",
    "CurrencyCode": "NZD",
    "CountryCode": "NZ",
    "PaymentAmount": 1.0,
    "AmountPaid": 1.0,
    "EstablishedDateTime": "2023-09-27T06:31:16.553",
    "StartDateTime": "2023-09-27T06:31:16.553",
    "EndDateTime": "2023-09-27T06:31:37.55",
    "BankReceipt": "a8PwFrQnj16LCq",
    "BankReceiptDateTime": "2023-09-26T20:31:37.273",
    "TransactionStatusCode": "Completed",
    "ErrorCode": null,
    "ErrorMessage": "",
    "FinancialInstitutionCode": "iBankNZ01",
    "FinancialInstitutionName": "iBank NZ 01",
    "MerchantReference": "",
    "MerchantAccountSuffix": "000",
    "MerchantAccountNumber": "0012345",
    "PayerFirstName": "",
    "PayerFamilyName": "DemoShopperNZ",
    "PayerAccountSuffix": "000"
}