1

I'm trying to find my way through eBay API and I find it quite confusing. Like the API responds to my requests with a lot of data, except half of it is null or otherwise not set. I'm having this problem with the TransactionType objects that are returned.

There are two things that I actually want to find, PayPal transaction id and if the order was actually paid for. Let's skip the second one (it'll probably get it's own question if needed).

So my question is, can PayPal transaction id be actually extracted from eBay transaction using eBay API? If yes, how do I do that?

Based on my findings, this id should appear in TransactionType.ExternalTransaction, but for my test auction (which ended when I "bought" it using another sandbox account and successfully "paid" for it using PayPal sandbox), there is nothing there.

I've seen this post, but even after adding DetailLevelCodeType.ReturnAll to the DetailLevelList, there are no ExternalTransaction for the transactions within the order.

var apiCall = new GetOrdersCall(apiContext);
apiCall.NumberOfDays = 1;
apiCall.DetailLevelList = new DetailLevelCodeTypeCollection()
{
    DetailLevelCodeType.ReturnAll
};
apiCall.Execute();

Note, when I access transactions within the order I use SomeOrder.TransactionArray.Cast<eBay.Service.Core.Soap.TransactionType>()


It appears that if I explicitly ask for the transaction using GetItemTransactionsCall (setting DetailLevel to ReturnAll appears to be necessary) I can actually get information about the PayPal transaction.

var apiCall = new GetItemTransactionsCall(apiContext);
apiCall.DetailLevelList = new DetailLevelCodeTypeCollection()
{
    DetailLevelCodeType.ReturnAll
};
apiCall.ItemID = "someItemId";
apiCall.Execute();
var trans = apiCall.TransactionList.Cast<TransactionType>().ToList();
var extTrans = trans.First().ExternalTransaction.Cast<ExternalTransactionType>().ToList();
var payPalId = extTrans.First().ExternalTransactionID;

I'm only slightly disappointed that I can't pull all information about orders that were placed using one call to the API (there probably is still a way to get all the informations that I need using minimal amount of bulk calls).

Community
  • 1
  • 1
jahu
  • 5,427
  • 3
  • 37
  • 64

1 Answers1

3

GetItemTransactions will give you what you need. I've used it to obtain the PayPal transaction ID for transactions many times in the past without any problems. Specifically, Transaction.ExternalTransaction.ExternalTransactionID.

Drew Angell
  • 25,968
  • 5
  • 32
  • 51
  • 1
    Thanks a lot. `GetItemTransactions` request with `DetailLevel` `ReturnAll` gave me what I wanted. It's odd I couldn't get this information as a part of `GetOrdersCall`. This page https://ebay.custhelp.com/app/answers/detail/a_id/1550/~/linking-ebay-and-paypal-transactions mentions external transactions going missing for some reason, so maybe it's related to that. – jahu Sep 26 '14 at 14:05
  • I know It's 6 years later... but right now GetItenTransactions is returning a null ExternalTransaction. Any ideas? – IntelliData Jul 08 '20 at 18:31