My client has very exacting demands on how the Vendor TX Code supplied to Sage Pay during checkout is formatted.

Is it possible to change this information?

Thanks in advance for any advice.

---

Thanks to Ian and Adrian I figured this out - my solution follows:

I duplicated the file Merchant\_sagepay\_direct.php renaming the class to reflect the new gateway. 

In the \_build\_authorize\_or\_purchase method I added the line 

```
$request['VendorTxCode'] = "ClientSpecificTag_" . substr($request['Description'],strpos($request['Description'], "#") + 1) . "_" . $this->param('transaction_id');

```

This structures the TXcode as per the clients requirement eg: ClientSpecificTag\_OrderNumber\_Transaction\_ID (order number is stripped from the description).

In order to allow refunds to work I had to add a new method:

I also added a new method 

```
protected function _build_refund()
    {
        $this->require_params('reference');
        $reference = $this->_decode_reference($this->param('reference'));

        $request = parent::_build_refund();

        $request['RelatedVendorTxCode'] = "ClientSpecificTag_" . substr($request['Description'],strpos($request['Description'], "#") + 1) . "_" . $reference->VendorTxCode;

        return $request;
    }

```

Which ensures refund requests send the correct TX Code.

All tested and working fine.