paypal付款行动失踪

时间:2012-03-13 09:02:13

标签: php curl paypal

在我们的商店系统中集成PayPal时,我做了最新的文档。我刚刚发现它似乎在NVP中有PAYMENTREQUEST_n_PAYMENTACTION参数。

我使用SetExpressCheckout返回的令牌和PayerID获取付款详细信息。当我输出我返回的cURL时,我发现了这个:

[CHECKOUTSTATUS] => PaymentActionNotInitiated

什么似乎是问题?

我在cURL中使用此查询:

// Prepare PayPal API URL
$url = "https://api-3t.sandbox.paypal.com/nvp";

// $PAYMENTACTION = "Sale"

// Prepare PayPal NVP (Name-Value Pair) payment request
$nvp = "METHOD=" . $SETMETHOD;
$nvp .= "&VERSION=" . $VERSION;
$nvp .= "&USER=" . $USERNAME;
$nvp .= "&PWD=" . $PASSWORD;
$nvp .= "&SIGNATURE=" . $SIGNATURE;
$nvp .= "&PAYMENTREQUEST_0_PAYMENTACTION=" . $PAYMENTACTION;
$nvp .= "&PAYMENTREQUEST_0_CURRENCYCODE=" . $CURRENCY;
$nvp .= "&SOLUTIONTYPE=" . $SOLUTIONTYPE;
$nvp .= "&RETURNURL=" . $RETURNURL;
$nvp .= "&CANCELURL=" . $CANCELURL;
$nvp .= "&L_PAYMENTREQUEST_0_NAME0=" . $PAYMENTNAME0;
$nvp .= "&L_PAYMENTREQUEST_0_DESC0=" . $PAYMENTDESC0;
$nvp .= "&L_PAYMENTREQUEST_0_AMT0=" . $PAYMENTAMT0;
$nvp .= "&L_PAYMENTREQUEST_0_QTY0=" . $PAYMENTQTY0;
$nvp .= "&PAYMENTREQUEST_0_ITEMAMT=" . $PAYMENTITEMAMT;
$nvp .= "&PAYMENTREQUEST_0_AMT=" . $PAYMENTAMT;
$nvp .= "&PAYMENTREQUEST_0_CURRENCYCODE=" . $CURRENCY;
$nvp .= "&LOCALECODE=" . $LOCALECODE;
$nvp .= "&HDRIMG=" . $HEADERLOGO;
$nvp .= "&PAYFLOWCOLOR=" . 262626;

1 个答案:

答案 0 :(得分:9)

PaymentActionNotInitiated未提及PAYMENTREQUEST_0_PAYMENTACTION 这仅仅意味着您还没有将买家引导到PayPal页面以确认他/她的付款。

总结一下,这就是Express Checkout的工作原理:

  1. SetExpressCheckout设置付款并返回令牌
  2. 您将买家重定向到https://www.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token=TOKEN-HERE,其中TOKEN-HERE是您之前收到的令牌
  3. 买家同意付款后,他将返回您的网站
  4. 您可以调用GetExpressCheckoutDetails并提供令牌作为参数以获取买方的PAYERID。
  5. 使用提供的令牌和PAYERID调用DoExpressCheckoutPayment以完成付款