就我目前所知,有三种必须的方法才能完成完整的交易。
SetExpressCheckout 有道理,我创建它的项目和所有付款,然后将用户重定向到我收到的响应redirecturi。
GetExpressCheckoutDetails 该方法应该位于SetExpressCheckout的returnurl指定的url上。通过让这来自贝宝并使用它来调用这个方法的道理,我们可以得到付款人的ID,我们将用它来调用的最后方法DoExpressCheckoutPayment
DoExpressCheckoutPayment 该方法需要令牌和计费用户标识,我们现在都有。它还要求付款和付款项目才能真正完成交易。
现在我的问题是:
在我RETURNURL,我打电话都GetExpressCheckoutDetails然后DoExpressCheckoutPayment。现在 - 我能否始终坚持一切都是正确的,并且在调用这两件事情时交易将会通过?我在想,如果用户没有足够的资金,也许Paypal不会继续使用returnurl?
为什么我们需要在DoExpressCheckoutPayment中再次指定付款项目?当我们已经在SetExpressCheckout中完成时?
我很习惯其他支付网关,只需启动付款 - >重定向到支付网关 - >完成。当交易完成后,他们在那里进行回拨,然后我可以设置完成的订单并将物品交付给用户。
我希望有人能澄清事情对我来说,一劳永逸(有关于这个这么多similiar问题)
更新
$DECPFields = array(
'token' => $_GET['token'], // Required. A timestamped token, the value of which was returned by a previous SetExpressCheckout call.
'payerid' => $_GET['PayerID'], // Required. Unique PayPal customer id of the payer. Returned by GetExpressCheckoutDetails, or if you used SKIPDETAILS it's returned in the URL back to your RETURNURL.
'returnfmfdetails' => '1', // Flag to indiciate whether you want the results returned by Fraud Management Filters or not. 1 or 0. 'allowedpaymentmethod' => 'InstantPaymentOnly', // The payment method type. Specify the value InstantPaymentOnly.
'buttonsource' => '', // ID code for use by third-party apps to identify transactions in PayPal.
'USESESSIONPAYMENTDETAILS' => '1'
);
$PayPalRequest = array(
'DECPFields' => $DECPFields
);
$decp = $PayPal -> DoExpressCheckoutPayment($PayPalRequest);
这是请求/响应
Array
(
[TIMESTAMP] => 2014-04-13T00:14:26Z
[CORRELATIONID] => 7f6dd4f8798aa
[ACK] => Failure
[VERSION] => 112.0
[BUILD] => 10567876
[L_ERRORCODE0] => 10400
[L_SHORTMESSAGE0] => Transaction refused because of an invalid argument. See additional error messages for details.
[L_LONGMESSAGE0] => Order total is missing.
[L_SEVERITYCODE0] => Error
[ERRORS] => Array
(
[0] => Array
(
[L_ERRORCODE] => 10400
[L_SHORTMESSAGE] => Transaction refused because of an invalid argument. See additional error messages for details.
[L_LONGMESSAGE] => Order total is missing.
[L_SEVERITYCODE] => Error
)
)
[PAYMENTS] => Array
(
)
可以说我不使用useraction = commit - paypal有什么想法?创建订单 - >重定向到PayPal - >返回商家网站审查订单? (但不是快速结账,所以你不会回到商家店铺,直到你完成完成?) - 因为我仍然不明白getExpressCheckoutDetails部分,为什么它有 – Karem
定期流程将包括用户被发送到PayPal登录或输入cc详细信息,然后查看订单并单击继续。那时他们会被送回你的网站。您将使用GECD获取送货地址,以便您可以计算可能需要应用的送货/税款,并在致电DECP完成整件事之前向买方显示最终评估页。 –
非常好的解释!所以我使用了useraction = commit,所以即使我有USESESSIONPAYMENTDETAILS和token,payerid提供时,我仍然可以直接调用DoExpressCheckoutPayment:Order total is missing? – Karem