0

我在我的网站上设置了一个支付系统,其工作方式如下。

买家购买商品我执行 SetExpressCheckout 调用,返回成功或失败。成功后,我使用返回的令牌进行提交。提交成功后,我将项目标记为已售出或减少数量。

我遇到的问题是,如果交易完成且没有待处理状态,我当前的程序有效,但为了处理待处理的项目,我执行以下操作

检查用户是否有任何待处理的项目

$sql = "SELECT * FROM basket_items WHERE status = 'pending' AND userID = '$user_id'";
$pending_items = queryArray($sql);

foreach($pending_items as $item){
    $token = $item['token'];
    //get status of the pending transaction
    $transaction_details = GetExpressCheckoutDetails($token);
    $trans_status = $EXP_CHECK_DETAILS['CHECKOUTSTATUS'];

    if($trans_status == 'completed'){
        MarkItemSold($item['id']);
    }
}

此过程的问题是,如果具有待处理授权操作的买方/卖方时间超过 3 小时,则令牌无效。所以这给我留下了2个查询

  1. 令牌过期后如何处理已完成的交易而不尝试再次购买该物品?

  2. 我可以从 getTransactionDetails 获取买家的邮寄地址吗?

谢谢

4

1 回答 1

1

Try the GetTransactionDetails API call instead. If you submitted a DoExpressCheckoutPayment call you would get a transaction ID you can use to look up the payment. The response would tell you the status of the transaction within PayPal and give you the shipping address (if provided or requested during the original transaction).

The transaction ID doesn't expire.

I'm not sure if I'm 100% clear on your process though. Are you processing transactions as an Authorization?

于 2013-05-30T21:15:24.943 回答