首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >从DoExpressCheckoutPayment回复中获取transactionId

从DoExpressCheckoutPayment回复中获取transactionId
EN

Stack Overflow用户
提问于 2012-10-10 05:45:04
回答 1查看 1.8K关注 0票数 0

我很难从somehwere的回复中获得交易id和其他信息,我花了几个晚上阅读,但我不是不明白发生了什么,就是弄错了什么。

这里有一些代码

代码语言:javascript
复制
    function ConfirmPayment( $FinalPaymentAmt )
{

    //Format the other parameters that were stored in the session from the previous calls   
    $token              = urlencode($_SESSION['TOKEN']);
    $paymentType        = urlencode($_SESSION['PaymentType']);
    $currencyCodeType   = urlencode($_SESSION['currencyCodeType']);
    $payerID            = urlencode($_SESSION['payer_id']);

    $serverName         = urlencode($_SERVER['SERVER_NAME']);

    $nvpstr  = '&TOKEN=' . $token . '&PAYERID=' . $payerID . '&PAYMENTREQUEST_0_PAYMENTACTION=' . $paymentType . '&PAYMENTREQUEST_0_AMT=' . $FinalPaymentAmt;
    $nvpstr .= '&PAYMENTREQUEST_0_CURRENCYCODE=' . $currencyCodeType . '&IPADDRESS=' . $serverName; 

     /* Make the call to PayPal to finalize payment
        If an error occured, show the resulting errors
        */
    $resArray=hash_call("DoExpressCheckoutPayment",$nvpstr);

    /* Display the API response back to the browser.
       If the response from PayPal was a success, display the response parameters'
       If the response was an error, display the errors received using APIError.php.
       */
    $ack = strtoupper($resArray["ACK"]);

    return $resArray;
}

然后

代码语言:javascript
复制
$resArray = ConfirmPayment($finalPaymentAmount);
$ack = strtoupper($resArray["ACK"]);
if ($ack == "SUCCESS" || $ack == "SUCCESSWITHWARNING") {

    $transactionId = $resArray["TRANSACTIONID"]; // ' Unique transaction ID of the payment. Note:  If the PaymentAction of the request was Authorization or Order, this value is your AuthorizationID for use with the Authorization & Capture APIs.
    $transactionType = $resArray["TRANSACTIONTYPE"]; //' The type of transaction Possible values: l  cart l  express-checkout
    $paymentType = $resArray["PAYMENTTYPE"]; //' Indicates whether the payment is instant or delayed. Possible values: l  none l  echeck l  instant
    $orderTime = $resArray["ORDERTIME"]; //' Time/date stamp of payment

等等等等

的工作,因为它完成了贝宝付款,它只是$transactionID和其他总是空的,我想记录这些

some1能为我指明正确的方向吗

谢谢克雷格

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2012-10-10 06:01:02

根据PayPal's DoExpressCheckoutPayment API操作文档:

TRANSACTIONID从版本63.0起不再推荐使用。请改用PAYMENTINFO_n_TRANSACTIONID。

同样,PAYMENTTYPETRANSACTIONTYPEORDERTIME也被弃用。检查提供的链接,查找响应消息中更新的变量名。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/12808889

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档