Quickpay formular med selvangivet beløbsfelt
Jeg vil gerne lave en quickpay betalingsformular, hvor man selv skriver beløbet.Nedenstående felt der henter variabelværdien
<input type="text" name="amount" value="<?php echo $params["amount"] ?>">
virker fint, men jeg vil gerne lave et felt som
<input type="text" name="amount" value="">
Hvis man lader variablen stå tom, som her:
// "amount" => "", //
kommer en fejlmelding.
Håber nogen kan hjælpe
- - - -
<?php
function sign($params, $api_key) {
ksort($params);
$base = implode(" ", $params);
return hash_hmac("sha256", $base, $api_key);
}
$params = array(
"amount" => 135,
"callbackurl" => "http://min-callback.php",
"cancelurl" => "http://min-error.php",
"continueurl" => "http://min-ok.php",
"autocapture" => "0",
"autofee" => "1",
"currency" => "DKK",
"deadline" => 300,
"order_id" => time(),
"payment_methods" => "creditcard,mobilepay,paypal",
"version" => "v10",
"branding_id" => "",
"merchant_id" => xxxx,
"agreement_id" => xxxxx,
);
$params["checksum"] = sign($params, "nøglekode");
?>
<form method="POST" action="https://payment.quickpay.net">
<input type="hidden" name="version" value="<?php echo $params["version"] ?>">
<input type="hidden" name="merchant_id" value="<?php echo $params["merchant_id"] ?>">
<input type="hidden" name="agreement_id" value="<?php echo $params["agreement_id"] ?>">
<input type="hidden" name="order_id" value="<?php echo $params["order_id"] ?>">
<input type="text" name="amount" value="<?php echo $params["amount"] ?>">
<input type="hidden" name="currency" value="<?php echo $params["currency"] ?>">
<input type="hidden" name="continueurl" value="<?php echo $params["continueurl"] ?>">
<input type="hidden" name="cancelurl" value="<?php echo $params["cancelurl"] ?>">
<input type="hidden" name="callbackurl" value="<?php echo $params["callbackurl"] ?>">
<input type="hidden" name="autofee" value="<?php echo $params["autofee"] ?>">
<input type="hidden" name="autocapture" value="<?php echo $params["autocapture"] ?>">
<input type="hidden" name="payment_methods" value="<?php echo $params["payment_methods"] ?>">
<input type="hidden" name="deadline" value="<?PHP echo $params["deadline"] ?>">
<input type="hidden" name="branding_id" value="<?php echo $params["branding_id"] ?>">
<input type="hidden" name="checksum" value="<?PHP echo $params["checksum"] ?>">
<input type="submit" value="Gå til dankort betaling...">
</form>