Ok, try it out, with some slight modifications (mostly due to SSL, for testing):
The below is just for testing. Please make sure to use the correct auth code, in the code below (between the base64_encde('')) and you also might need to change the url in curl_init if they are using a different testing url.
The code below should foward to the payment at Poli and return back on successful/failed payments and cancellations.
If that works, then we can go on further and add some spice to it.
There might be an issue with SSL, since they suggest to use a cert but I turned off all SSL checks for testing.
If that happens, we will need to adjust it a bit and add a certificate file on your server.
Copy this into your form => advanced => more options => submit pieces => end submit, and do a form submission:
$json_builder = '{
"Amount":"1.2",
"CurrencyCode":"AUD",
"MerchantReference":"CustomerRef12345",
"MerchantHomepageURL":'.json_encode(JURI::getInstance()->toString() . ',
"SuccessURL":'.json_encode(JURI::getInstance()->toString() . '&poli_success=true').',
"FailureURL":'.json_encode(JURI::getInstance()->toString() . '&poli_success=false').',
"CancellationURL":'.json_encode(JURI::getInstance()->toString() . '&poli_cancel=true').',
"NotificationURL":'.json_encode(JURI::getInstance()->toString() . '&poli_notification=true').'
}';
$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_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
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"]);