function jazzcash_donation_form() {
ob_start();
// =====================================
// JAZZCASH CREDENTIALS
// =====================================
$MerchantID = “MC990064”;
$Password = “79mis98qy0”;
$HashKey = “9x41n1dm5i”;
$ReturnURL = “https://mabtrust.hospital/jazzcash-response/”;
$PostURL = “https://onlinepayments.jazzcash.com.pk/payment-orchestrator/CustomerPortal/transactionmanagement/merchantform”;
// =====================================
// DATE/TIME
// =====================================
date_default_timezone_set(“Asia/Karachi”);
$TxnDateTime = date(‘YmdHis’);
$TxnExpiryDateTime = date(
‘YmdHis’,
strtotime(‘+3 Days’)
);
$TxnRefNumber = “T” . date(‘YmdHis’) . mt_rand(10,100);
// =====================================
// STATIC PARAMETERS
// =====================================
$BillReference = “MABTrust”;
$Description = “Hospital Donation”;
$Language = “EN”;
$TxnCurrency = “PKR”;
$TxnType = “MWALLET”;
$Version = “2.0”;
$SubMerchantID = “”;
$BankID = “”;
$ProductID = “”;
$ppmpf_1 = “”;
$ppmpf_2 = “”;
$ppmpf_3 = “”;
$ppmpf_4 = “”;
$ppmpf_5 = “”;
// =====================================
// FORM SUBMISSION
// =====================================
if(isset($_POST[‘submit_payment’])){
$Amount = intval($_POST[‘user_amount’]) * 100;
$HashArray = [
$Amount,
$BankID,
$BillReference,
$Description,
$Language,
$MerchantID,
$Password,
$ProductID,
$ReturnURL,
$TxnCurrency,
$TxnDateTime,
$TxnExpiryDateTime,
$TxnRefNumber,
$TxnType,
$Version,
$ppmpf_1,
$ppmpf_2,
$ppmpf_3,
$ppmpf_4,
$ppmpf_5
];
$SortedArray = $HashKey;
foreach($HashArray as $value){
if(
$value != ‘undefined’ &&
$value != null &&
$value != “”
){
$SortedArray .= “&” . $value;
}
}
// =====================================
// GENERATE HASH
// =====================================
$Securehash = hash_hmac(
‘sha256’,
$SortedArray,
$HashKey
);
?>