Sagepay is tricky because the notification part is done by Sagepay and not by the client, so make sure you give an Internet accessible notification URL (that was my first mistake). Here's some example code (using Laravel) to process a Sagepay payment:
public function postProcess($transactionId)
{
//get the order details from somewhere
$order = $this->order->findByTransaction($transactionId);
$response = $this->gateway->completePurchase(array(
'transactionId' => $order->transaction,
'transactionReference' => $order->reference,
'amount' => $order->total,
'currency' => $order->currency,
))->send();
if ( ! $response->isSuccessful())
{
$response->invalid(URL::to('checkout/problem'));
die();
}
$response->confirm(URL::to('checkout/complete/'.$transactionId));
}
As you can see it's quite a bit different from the other examples as you need to call completePurchase() and then separately send a response to confirm.
Let me know if you need anymore help.
Cheers