paypal此交易无法处理。收费金额为零

时间:2014-05-26 13:51:17

标签: php paypal opencart

这是我使用的代码

 $max_amount = 20;
            //$max_amount = $this->currency->convert($order_info['total'], $this->config->get('config_currency'), 'USD');

            $max_amount = min($max_amount * 1.25, 10000);
            $max_amount = $this->currency->format($max_amount, $this->currency->getCode(), '', false);
            $max_amount = $max_amount*100;
            $data = array(
                'METHOD' => 'SetExpressCheckout',
                'MAXAMT' => $max_amount,
                            'AMT'    => 1000,
                'RETURNURL' => $this->url->link('payment/pp_express/checkoutReturn', '', 'SSL'),
                'CANCELURL' => $this->url->link('checkout/checkout', '', 'SSL'),
                'REQCONFIRMSHIPPING' => 0,
                'NOSHIPPING' => 1,
                'LOCALECODE' => 'EN',
                'LANDINGPAGE' => 'Login',
                'HDRIMG' => $this->model_tool_image->resize($this->config->get('pp_express_logo'), 790, 90),
                'HDRBORDERCOLOR' => $this->config->get('pp_express_border_colour'),
                'HDRBACKCOLOR' => $this->config->get('pp_express_header_colour'),
                'PAYFLOWCOLOR' => $this->config->get('pp_express_page_colour'),
                'CHANNELTYPE' => 'Merchant',
                'ALLOWNOTE' => $this->config->get('pp_express_allow_note'),
            );

            $data = array_merge($data, $this->model_payment_pp_express->paymentRequestInfo());
            echo '<pre>';
            $result = $this->model_payment_pp_express->call($data);

            print_r($result);

print_r($ result)的结果是

Array
(
    [TIMESTAMP] => 2014-05-26T13:48:19Z
    [CORRELATIONID] => d5ff8073cbde
    [ACK] => Failure
    [VERSION] => 65.2
    [BUILD] => 11110362
    [L_ERRORCODE0] => 10525
    [L_SHORTMESSAGE0] => Invalid Data
    [L_LONGMESSAGE0] => This transaction cannot be processed. The amount to be charged is zero.
    [L_SEVERITYCODE0] => Error
)

我是否需要整理数值?

1 个答案:

答案 0 :(得分:0)

您的请求中未包含AMT参数。因此,它被视为PayPal不接受的零值。

您需要添加AMT参数并在发出SEC请求时传递当前的订单金额。当然,这个数额可能会在该时间和最终的DoExpressCheckoutPayment请求之间发生变化,但您只需要确保最终金额不会超过您在此处传递的MAXAMT。