private function getRefundURL($paymentDetails) {
		if (!is_object($paymentDetails))
			throw new Exception("Invalid payment details in getRefundURL");
		if (!is_array($paymentDetails->transactions))
			throw new Exception("Invalid transaction list in getRefundURL");
		foreach ($paymentDetails->transactions as $transact) {
			if (!is_array($transact->related_resources))
				throw new Exception("Invalid related resources in getRefundURL");
			foreach ($transact->related_resources as $res) {
				if (!is_array($res->sale->links))
					throw new Exception("Invalid related links in getRefundURL");
				foreach ($res->sale->links as $link) {
					if ($link->rel == 'refund')
						return $link->href;
				}
			}
		}
		throw new Exception("Missing refund URL in getRefundURL");
	}