SetSubName($name); if($description != "") $subupd->SetDescription($description); if($periodType != "") $subupd->SetPeriodType($periodType); if($length != "") $subupd->SetLength($length); if($recurringAmount != "") $subupd->SetRecurringAmount($recurringAmount); if($type != "") $subupd->SetSubType($type); if($startDate != "") $subupd->SetStartDate($startDate); if($endDate != "") $subupd->SetEndDate($endDate); if($eDCCDecision != "") $subupd->EDCCDecision($eDCCDecision); $response = $subupd->ProcessRequestToGateway($secret,$testMode,$gateway); if($response->IsError()) { echo 'AN ERROR OCCURED, Subscription not updated. Error details: ' . $response->ErrorString(); } else { $expectedResponseHash = md5($terminalId.$response->MerchantReference().$response->DateTime().$secret); if($expectedResponseHash != $response->Hash()) { echo 'SUBSCRIPTION UPDATE FAILED: INVALID RESPONSE HASH. Please contact ' . $adminEmail . ' or call ' . $adminPhone . ' to clarify if your card will be billed.'; $merchantRef = $response->MerchantReference(); if(isset($merchantRef)) { echo 'Please quote %Gateway Terminal ID: ' . $terminalId . ', and Subscription Merchant Reference: ' . $response->MerchantReference() . ' when mailling or calling.'; } } else echo "Subscription successfully updated."; } ?>