SetNewStoredSubscriptionValues($name, $description, $periodType, $length, $currency, $recurringAmount, $initialAmount, $type, $onUpdate, $onDelete); else if($recurringAmount != "" || $initialAmount != "") $subreg->SetSubscriptionAmounts($recurringAmount, $initialAmount); if($endDate != "") $subreg->SetEndDate($endDate); if($eDCCDecision != "") $subreg->EDCCDecision($eDCCDecision); $response = $subreg->ProcessRequestToGateway($secret,$testMode,$gateway); if($response->IsError())echo 'AN ERROR OCCURED, Subscription not created. Error details: ' . $response->ErrorString(); else { $expectedResponseHash = md5($terminalId.$response->MerchantReference().$response->DateTime().$secret); $merchantReference =$response->MerchantReference(); if($expectedResponseHash != $response->Hash()) { echo 'SUBSCRIPTION REGISTRATION FAILED: INVALID RESPONSE HASH. Please contact ' . $adminEmail . ' or call ' . $adminPhone . ' to clarify if your card will be billed.'; if(isset($merchantReference))echo 'Please quote %Gateway Terminal ID: ' . $terminalId . ', and Subscription Merchant Reference: ' . $response->MerchantReference() . ' when mailling or calling.'; } else echo "Subscription successfully setup and setup payment processed succesfully."; } ?>