"; } # This generates a DATETIME value in the correct format expected in the request. function requestDateTime() { return date('d-m-Y:H:i:s:000'); } # This is used to generate the Authorisation Request Hash. function subscriptionRequestHash($merchantRef, $secureCardMerchantRef, $dateTime, $startDate) { global $terminalId, $secret; return md5($terminalId . $merchantRef . $secureCardMerchantRef . $dateTime . $startDate . $secret); } # This function is used to validate that the MPI Response Hash from the server is correct. # If subscriptionResponseHashIsValid(...) != $_REQUEST["HASH"] then an error should be shown and the Subscription registration should fail. function subscriptionResponseHashIsValid($responseCode, $responseText, $subscriptionMerchantRef, $dateTime, $responseHash) { global $terminalId, $secret; return (md5($terminalId . $responseCode . $responseText . $subscriptionMerchantRef . $dateTime . $secret)==$responseHash); } ?>