paypal useraction = commit不给付费按钮。 PHP

时间:2016-06-16 16:41:21

标签: php paypal

我在php中有以下代码

        $postData = "USER=xxxxxx"
            . "&PWD=xxxxxxxx"
            . "&SIGNATURE=xxxxxxx"
            . "&METHOD=SetExpressCheckout"
            . "&VERSION=93"
            . "&EMAIL=" . $_POST['email']
            . "&PAYMENTREQUEST_0_SHIPTOPHONENUM=" . $_POST['phone']
            . "&PAYMENTREQUEST_0_AMT=" . $price
            . "&PAYMENTREQUEST_0_ITEMAMT=" . $price
            . "&PAYMENTREQUEST_0_PAYMENTACTION=SALE"
            . "&PAYMENTREQUEST_0_DESC=" . $plan['fullname']
            . "&L_PAYMENTREQUEST_0_NAME0=" .$plan['fullname']
            . "&L_PAYMENTREQUEST_0_AMT0=$price"
            . "&L_PAYMENTREQUEST_0_QTY0=1"
            . "&RETURNURL=http://localhost/bemo/casperreg"
            . "&CANCELURL=http://bemoacademicconsulting.com/casperprep-internal";

        $ch = curl_init();
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); // this line makes it work under https
        curl_setopt($ch, CURLOPT_URL, "https://api-3t.paypal.com/nvp");
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($ch, CURLOPT_POST, true);

        // Ready the postData to send
        curl_setopt($ch, CURLOPT_POSTFIELDS, $postData);

        // Send the data to Paypal and assign the repsonse
        $resp = curl_exec($ch);
        parse_str($resp,$arr);

        redirect::to("https://www.paypal.com/checkoutnow?token=" . $arr['TOKEN'] . "&useraction=commit");

现在从技术上来说,这里的一切都有效,除非事实上即使它说useraction = commit我也不会得到现在付费按钮。有人可以帮帮我吗?

另外作为奖励问题,即使我将电话号码传递给PayPal,我也不会在PayPal页面上看到它。这是我可以做的事情吗?

谢谢! 诺尔

1 个答案:

答案 0 :(得分:1)

快速结账的正确重定向地址应为
https://www.paypal.com/cgi-bin/webscr?cmd=_express-checkout&useraction=commit&token=[token number]
资料来源:Developer Guide

关于你的奖金问题
1.尝试在数字xxx-xxx-xxxx上进行字段掩码 2.检查商家资料中是否设置了电话号码