Ok, then try this. I am assuming the "stallholderID" is the "MerchantReference".
The field for the record id isn't required because end submit pieces have a populated $this->record_id.
Please try it out. It should forward to Poli and let you do payments.
If this works, we will add a final step, accepting the fail, success or cancelled notifications.
$this->execPieceByName('ff_InitLib');
$json_builder = '{
"Amount": '.json_encode( ff_getSubmit('siteTotal') ).',
"CurrencyCode":"NZD",
"MerchantReference":'.json_encode( ff_getSubmit('stallholderID') ).',
"MerchantHomepageURL":'.json_encode(JURI::getInstance()->toString()) . ',
"SuccessURL":'.json_encode(JURI::getInstance()->toString() . '&poli_success=true&record_id=' . $this->record_id) .',
"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('SS64010180:bM9^bZAcNwB5V');
$header = array();
$header[] = 'Content-Type: application/json';
$header[] = 'Authorization: Basic '.$auth;
$ch = curl_init("https://poliapi.apac.paywithpoli.com/api/v2/Transaction/Initiate");
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);
//print_r($json);
//exit;
header('Location: '.$json["NavigateURL"]);