doumengmian1180 2016-02-10 14:34
浏览 88
已采纳

PayPal IPN,eBay多行订单ebay_txn_id = 0 [关闭]

I am building a system to automatically process our PayPal orders through both a website cart and eBay transactions. When an order comes through eBay which is a combined invoice order (multiple items bought at the same time through eBay) the eBay transaction ID (ebay_txn_id) for each item is 0.

I use the eBay transasction ID to gain more information about the order that eBay does not send us and I cannot find any other ID in the IPN that can help with this.

Anyone else have this issue?

  • 写回答

1条回答 默认 最新

  • douyou1960 2016-02-11 05:30
    关注

    The item_number for each cart item in the IPN data is the eBay auction number. You can hit eBay's GetItemTransactions API to pull all of the transactions associated with that particular item/auction.

    Of course, there could be more than one transaction associated with an individual auction, so to ensure you're grabbing the correct data you can use some XPath.

    The eBay transaction data includes the PayPal transaction ID in what it calls "external transaction" data.

    I just recently did all of this in a project of my own, and this is what I used to pull the specific data based on the PayPal transaction ID.

    $DOM = new DOMDocument();
    $DOM->loadXML($GetItemTransactionsResponse);
    $XPath = new DOMXPath($DOM);
    $XPath->registerNamespace("ns","urn:ebay:apis:eBLBaseComponents");
    
    $eBayTransID = $XPath->query("//ns:Transaction[ns:ExternalTransaction/ns:ExternalTransactionID = '" . $txn_id . "']/ns:TransactionID/text()")->item(0)->data;
    $shipping_method = $XPath->query("//ns:Transaction[ns:ExternalTransaction/ns:ExternalTransactionID = '" . $txn_id . "']/ns:ShippingServiceSelected/ns:ShippingService/text()")->item(0)->data;
    $buyer_feedback_score = $XPath->query("//ns:Transaction[ns:ExternalTransaction/ns:ExternalTransactionID = '" . $txn_id . "']/ns:Buyer/ns:FeedbackScore/text()")->item(0)->data;
    

    So the XPath being used there is basically saying "grab this data where the ExternalTransactionID = $txn_id, which is from the PayPal IPN data.

    So it's a few pieces to plug together but it will work nicely for you.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 软件测试决策法疑问求解答
  • ¥15 win11 23H2删除推荐的项目,支持注册表等
  • ¥15 matlab 用yalmip搭建模型,cplex求解,线性化处理的方法
  • ¥15 qt6.6.3 基于百度云的语音识别 不会改
  • ¥15 关于#目标检测#的问题:大概就是类似后台自动检测某下架商品的库存,在他监测到该商品上架并且可以购买的瞬间点击立即购买下单
  • ¥15 神经网络怎么把隐含层变量融合到损失函数中?
  • ¥15 lingo18勾选global solver求解使用的算法
  • ¥15 全部备份安卓app数据包括密码,可以复制到另一手机上运行
  • ¥20 测距传感器数据手册i2c
  • ¥15 RPA正常跑,cmd输入cookies跑不出来