php - PayPal订单总计缺失

时间:2014-03-06 20:15:14

标签: php paypal-adaptive-payments paypal

我目前正在我的网站上的灯箱中集成PayPal自适应付款(快速结账)。一切都很顺利 - >用户可以付费,但每当有人付费购买物品时,使用快速结账,这就是回复:

API响应:

TIMESTAMP = 2014-03-06T20:10:30Z
CORRELATIONID = 505b77f3bea1
ACK = Failure
VERSION = 97.0
BUILD = 9917844
L_ERRORCODE0 = 10400
L_ERRORCODE1 = 10406
L_SHORTMESSAGE0 = Transaction refused because of an invalid argument. See additional error messages for details.
L_SHORTMESSAGE1 = Transaction refused because of an invalid argument. See additional error messages for details.
L_LONGMESSAGE0 = Order total is missing.
L_LONGMESSAGE1 = The PayerID value is invalid.
L_SEVERITYCODE0 = Error
L_SEVERITYCODE1 = Error

这是剧本:

$nvps = array();
$nvps["VERSION"] = "97.0";

// Single-item purchase
$nvps["METHOD"] = "SetExpressCheckout";
$nvps["RETURNURL"] = "http://www.zerogravityprogramming.com/PayPal/Articles/DigitalGoodsExpressCheckout/App/success.php"; // server
$nvps["CANCELURL"] = "http://www.zerogravityprogramming.com/PayPal/Articles/DigitalGoodsExpressCheckout/App/fail.html"; // server

$nvps["PAYMENTREQUEST_0_PAYMENTACTION"] = "Sale";
$nvps["PAYMENTREQUEST_0_NOTIFYURL"] = "http://www.yourdomain.com/PayPal/YourPayPalListener.php";
$nvps["PAYMENTREQUEST_0_AMT"] = "$Price";
$nvps["PAYMENTREQUEST_0_CURRENCYCODE"] = "USD";
$nvps["PAYMENTREQUEST_0_ITEMAMT"] = "$Price";
$nvps["L_PAYMENTREQUEST_0_NAME0"] = "$Desc";
$nvps["L_PAYMENTREQUEST_0_NUMBER0"] = "$Item";
$nvps["L_PAYMENTREQUEST_0_AMT0"] = "$Price";
$nvps["L_PAYMENTREQUEST_0_QTY0"] = "1";
$nvps["L_PAYMENTREQUEST_0_ITEMCATEGORY0"] = "Digital"; // specific to Digital Goods

// Since it's a digital good (and not physical), we don't need a shipping address.
$nvps["REQCONFIRMSHIPPING"] = "0";
$nvps["NOSHIPPING"] = "1";

$Price$Desc$Item变量都有一个值 - 所以这不是问题。

有人能搞清楚吗?

提前致谢:)

2 个答案:

答案 0 :(得分:0)

我看到您正在从Sandbox发出此API请求。 setexpressCheckout API respnse“成功” GetExpressCheckoutDetailsRequest我们收到了您的回复,并显示错误消息:

Express Checkout token was issued for a merchant account other than yours.

这主要是由于: 您正在为SetExpressCheckout和DoExpressCheckoutPayment使用不同的API凭据。

我认为您正在处理返回URL中的某些内容,这些内容正在执行一些错误的API调用。

我在这里测试过:

VERSION = 97.0
METHOD = SetExpressCheckout
RETURNURL = http://www.zerogravityprogramming.com/PayPal/Articles/DigitalGoodsExpressCheckout/App/success.php
CANCELURL = http://www.zerogravityprogramming.com/PayPal/Articles/DigitalGoodsExpressCheckout/App/fail.html

PAYMENTREQUEST_0_PAYMENTACTION = Sale
PAYMENTREQUEST_0_NOTIFYURL = http://www.yourdomain.com/PayPal/YourPayPalListener.php
PAYMENTREQUEST_0_AMT = 20.00
PAYMENTREQUEST_0_CURRENCYCODE = USD
PAYMENTREQUEST_0_ITEMAMT = 20.00
L_PAYMENTREQUEST_0_NAME0 = Test
L_PAYMENTREQUEST_0_NUMBER0 =23
L_PAYMENTREQUEST_0_AMT0 = 20.00
L_PAYMENTREQUEST_0_QTY0 = 1
L_PAYMENTREQUEST_0_ITEMCATEGORY0 = Digital
REQCONFIRMSHIPPING = 0
NOSHIPPING = 1

NVP Response:
TOKEN=EC-3S848778KN463980F
TIMESTAMP=2014-03-07T02:53:56Z
CORRELATIONID=fbc726f1a782e
ACK=Success
VERSION=97.0
BUILD=9917844 


VERSION = 84.0
METHOD = DoExpressCheckoutPayment
TOKEN = EC-3S848778KN463980F
PAYMENTACTION = Sale
PAYERID = ZK5AUW8MWY9CW
AMT = 20.00




NVP Response:
TOKEN=EC-3S848778KN463980F
SUCCESSPAGEREDIRECTREQUESTED=false
TIMESTAMP=2014-03-07T02:57:05Z
CORRELATIONID=c7aac043d49fa
ACK=Success
VERSION=84.0
BUILD=9917844
TRANSACTIONID=0L15028545229094V
TRANSACTIONTYPE=expresscheckout
PAYMENTTYPE=instant
ORDERTIME=2014-03-07T02:57:04Z
AMT=20.00
FEEAMT=0.88
TAXAMT=0.00
CURRENCYCODE=USD
PAYMENTSTATUS=Completed
PENDINGREASON=None
REASONCODE=None
PROTECTIONELIGIBILITY=Ineligible
INSURANCEOPTIONSELECTED=false
SHIPPINGOPTIONISDEFAULT=false
PAYMENTINFO_0_TRANSACTIONID=0L15028545229094V
PAYMENTINFO_0_TRANSACTIONTYPE=expresscheckout
PAYMENTINFO_0_PAYMENTTYPE=instant
PAYMENTINFO_0_ORDERTIME=2014-03-07T02:57:04Z
PAYMENTINFO_0_AMT=20.00
PAYMENTINFO_0_FEEAMT=0.88
PAYMENTINFO_0_TAXAMT=0.00
PAYMENTINFO_0_CURRENCYCODE=USD
PAYMENTINFO_0_PAYMENTSTATUS=Completed
PAYMENTINFO_0_PENDINGREASON=None
PAYMENTINFO_0_REASONCODE=None
PAYMENTINFO_0_PROTECTIONELIGIBILITY=Ineligible
PAYMENTINFO_0_PROTECTIONELIGIBILITYTYPE=None
PAYMENTINFO_0_SECUREMERCHANTACCOUNTID=XTV2XWLQDBBUL
PAYMENTINFO_0_ERRORCODE=0
PAYMENTINFO_0_ACK=Success 

答案 1 :(得分:-1)

您是否在DoExpressCheckoutPayment中提供了PayerId?
PAYERID (必填)GetExpressCheckoutDetails响应中返回的唯一PayPal买方帐户标识号。
字符长度和限制:13个单字节字母数字字符