Creation

It is possible to create POLi Links through automation by integration with POLi Link API. When creating POLi Links in this way, there are a few characteristics to be aware of:

ValidationWhen creating POLi Links via Console, the user interface covers all validation and helps the user identify errors in their data entry. Through automation, you will be required to ensure that all data types and values fall within expected ranges and formats.
Extended FeaturesWhen creating POLi Links via Console, the user interface will only show extended features that the merchant has enabled. When setting features like partial payment and due date through POLi Link API, make sure these features are enabled by the merchant
Feature CombinationsThere are constraints which must be met when defining a POLi Link. These include requirements for the type of POLi Link and restrictions for extended features. Please consult the features page for more information

If care is taken with the above considerations, back-end validation will succeed and a POLi Link will be created. Failure will return limited information. For more information about using the Create command, visit the create page.

This code example will show you how to generate a POLi Link.

  • PHP
Loading ...
<?php
$json_builder = '{
  "LinkType":"0",
  "Amount":"1.2",
  "CurrencyCode":"AUD",
  "MerchantData":"CustomerRef12345",
  "MerchantReference":"CustomerRef12345",
  "ConfirmationEmail":"false",
  "AllowCustomerReference":"false",
  "ViaEmail":"false",
  "RecipientName":"false",
  "LinkExpiry":"2020-10-24 16:00:00+11",
  "RecipientEmail":"false"
}';
 
 $auth = base64_encode("MerchCode:AuthCode");
 $header = array();
 $header[] = 'Content-Type: application/json';
 $header[] = 'Authorization: Basic '.$auth;
 
 $ch = curl_init("https://poliapi.apac.paywithpoli.com/api/POLiLink/Create");
 //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);
 
 print_r($json);
?>

polilinkapi_create.txt · Last modified: 2017/01/20 10:11 (external edit)