Paypal API待付款 [英] Paypal API Pending Payments

查看:96
本文介绍了Paypal API待付款的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在自己的网站上设置了付款系统,其工作方式如下.

I have setup a payments system on my site which works as follows.

买方购买商品我执行SetExpressCheckout调用,该调用返回成功或失败.成功后,我将使用返回的令牌进行提交.提交成功后,我将商品标记为已售或扣减数量.

Buyer buys item I do a SetExpressCheckout call which returns a success or failure. On success, I do a commit with the returned token. On success of the commit, I then mark the item as sold or deduct quantity.

我遇到的问题是,如果在没有待处理状态的情况下完成交易,但是为了处理待处理项目,我会执行以下操作

The problem I am having is my current procedure works if the transactions is completed with no pending status but in order to process pending items I do the following

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

Check if user has any pending items

$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个查询

The problem with this procedure is, if the buyer / seller with the pending authorisation action takes more than 3hours, the token is invalid. So that leaves me with 2 queries

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

  1. How do i process completed transaction after the token has expired without trying to buy the item again?

我可以从getTransactionDetails获取买家的邮政地址吗?

Can i obtain the buyers postal address from getTransactionDetails?

谢谢

推荐答案

请改用GetTransactionDetails API调用.如果您提交了DoExpressCheckoutPayment调用,则会获得一个交易ID,可用于查找付款.响应将告诉您PayPal内交易的状态,并提供送货地址(如果在原始交易中提供或要求).

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).

交易ID不会过期.

我不确定您的流程是否100%明确.您是否正在将交易作为授权进行处理?

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

这篇关于Paypal API待付款的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆