\n";
$form .= "\n";
foreach ($formHiddenInputs as $name => $value) {
$form .= "\n";
}
$form .= "\n";
return $form;
}
/**
* Function Generates the html form
* @param accessKey - Put your Access Key here
* @param secretKey - Put your secret Key here
* @param amount - Enter the amount you want to collect for the ite
* @param description - description - Enter a description of the item
* @param referenceId - Optionally enter an ID that uniquely identifies this transaction for your records
* @param abandonUrl - Optionally, enter the URL where senders should be redirected if they cancel their transaction
* @param returnUrl - Optionally enter the URL where buyers should be redirected after they complete the transaction
* @param immediateReturn - Optionally, enter "1" if you want to skip the final status page in Amazon Payments,
* @param processImmediate - Optionally, enter "1" if you want to settle the transaction immediately else "0". Default value is "1"
* @param ipnUrl - Optionally, type the URL of your host page to which Amazon Payments should send the IPN transaction information.
* @param collectShippingAddress - Optionally, enter "1" if you want Amazon Payments to return the buyer's shipping address as part of the transaction information
* @param signatureMethod - Valid values are HmacSHA256 and HmacSHA1
* @param environment - Sets the environment where your form will point to can be "sandbox" or "prod"
* @return - A map of key of key-value pair for all non null parameters
* @throws Exception
*/
public static function GenerateForm($accessKey,$secretKey,$amount, $description, $referenceId, $immediateReturn,
$returnUrl, $abandonUrl, $processImmediate, $ipnUrl,$collectShippingAddress,
$signatureMethod,$environment) {
if($environment=="prod"){
$endPoint = self::$PROD_END_POINT;
$imageLocation = self::$PROD_IMAGE_LOCATION;
}
else
{
$endPoint= self::$SANDBOX_END_POINT;
$imageLocation = self::$SANDBOX_IMAGE_LOCATION;
}
$params = self::getSimplePayStandardParams($accessKey,$amount, $description, $referenceId, $immediateReturn,
$returnUrl, $abandonUrl, $processImmediate, $ipnUrl,$collectShippingAddress, $signatureMethod);
$serviceEndPoint = parse_url($endPoint);
$signature = SignatureUtils::signParameters($params, $secretKey,
self::$httpMethod, $serviceEndPoint['host'], $serviceEndPoint['path'],$signatureMethod);
$params[self::SIGNATURE_KEYNAME] = $signature;
$simplePayForm = self::getSimplePayStandardForm($params,$endPoint,$imageLocation);
print $simplePayForm . "\n";
}
}
?>