Sagepay退款错误 - 3047:VPSTxId格式无效

时间:2015-01-14 06:43:35

标签: sagepay

我在编写代码以退出Sagepay的交易时遇到错误:

  

3047:VPSTxId格式无效。

我在这里使用的代码是:

  if ($this->config->get('sagepay_direct_v3_test') == 'live') {
        $url = 'https://live.sagepay.com/gateway/service/refund.vsp';
        $payment_data['VPSProtocol'] = '3.00';
    } elseif ($this->config->get('sagepay_direct_v3_test') == 'test') {
        $url = 'https://test.sagepay.com/gateway/service/refund.vsp';
        $payment_data['VPSProtocol'] = '3.00';
    }


    $this->load->model('checkout/order');
    $this->load->model('payment/sagepay_direct_v3');
    $order_info = $this->model_checkout_order->getOrder($order_id);

    $sagepay_direct_v3_order = $this->getOrder($order_info['advance_order_confirmed_id']);


    $params = array();
    $params['VPSProtocol'] = urlencode($payment_data['VPSProtocol']);
    $params['TxType'] = urlencode('REFUND');
    $params['Vendor'] = urlencode($this->config->get('sagepay_direct_v3_vendor'));
    $params['VendorTxCode'] =  $this->request->get['order_id'] . 'T' . strftime("%Y%m%d%H%M%S") . mt_rand(1, 999);            
    $params['Amount'] = $this->currency->format($order_info['total'], $order_info['currency_code'], false, false);
    $params['Currency'] = $this->currency->getCode();
    $params['Description'] = urlencode(substr($this->config->get('config_name'), 0, 100));
    $params['RelatedVPSTxId'] =  urlencode($sagepay_direct_v3_order['VPSTxId']);
    $params['RelatedVendorTxCode'] = urlencode($this->request->get['order_id'] . 'T' . strftime("%Y%m%d%H%M%S") . mt_rand(1, 999));        
    $params['RelatedSecurityKey'] = urlencode($sagepay_direct_v3_order['SecurityKey']);
    $params['RelatedTxAuthNo'] = urlencode($sagepay_direct_v3_order['TxAuthNo']);
    $response = $this->model_payment_sagepay_direct_v3->sendCurl($url, $params);
var_dump( $response );

1 个答案:

答案 0 :(得分:0)

我怀疑这是因为你正在编码RelatedVPSTxId(以及其他字段)。