Listing past paypal transactions with API request - paypal

The goal is to list all the past transactions of a paypal account. The information that should be filtered out is: date of the transaction, amount, payer, receiver, purpose.
I experimented with paypal's "transaction search api" but the responses include a lot of unnecessary information. Furthermore, it only returns account_ids, e.g. "X005GHT889F". Is there a way to match the account_id with an email address or the account owner's name?
As this is a very general question, any help or hint into the right direction would be appreciated!

The transaction search API can return payer_info with the email; see its documentation.
Alternatively, you can trigger an Activity Download in CSV format via https://business.paypal.com/merchantdata/reportHome

Related

PAYPAL API: how to search transactions by payee's email

for my project I'm trying to list my end user's transactions when they log into my app. I want to get all the transactions for a user by their email (because it's the most unique identifier I have for them). I've looked through the paypal api docs for a way to search transactions by a payee's email via the /v1/reporting/transactions but I don't see any parameters that would allow that.
Am I missing something? is there really no way to search paypal for transactions by payee's email (or any payee info for that matter)?
There is no way. Keep a record of completed transactions in your own database.
For past transactions, the user can do an Activity Download of a CSV file from their account which you can import.

CyberSource: Retrieve Capture Token from PayPal Transaction Details

I'm trying to retrieve the capture request token from past PayPal transactions as I need that for refunding customers. We don't have that info anywhere on our systems anymore because, just don't even ask. It looks kind of like this:
AxjrrwSTQDiO3h+N6P5RABJPE8jCJjo7f4OxZX/x/FO5LcGBSKHWXfwtSx+j1ncoSt3SABJtkGk=
Is it possible to get that?
I looked at PayPal's Transaction Search API here and nothing in the response says that field exists:
https://developer.paypal.com/docs/api/transaction-search/v1/
I have also checked the built-in reports on PayPal but they don't give us that either.
Furthermore, I have tried the REST API with CyberSource and that doesn't provide the Token either:
https://developer.cybersource.com/api-reference-assets/index.html#transaction-details
I have the PayPal Generated Transaction ID, the dates, our reference numbers, etc. All I need is that Capture Request Token. I will then be able to refund customers using CyberSource.
Any help or ideas would be most appreciated.
That's a CyberSource token, so you won't find it anywhere within PayPal.
The PayPal REST API itself (no CyberSource) doesn't require it for refunds, only the transaction ID: https://developer.paypal.com/docs/api/payments/v2/#captures_refund

How to link related transactions obtained by TransactionSearch and GetTransactionDetails?

TL;DR- How do I know if I really did get paid, via the PayPal NVP API?
Longer version
I'm writing code to automagically process and classify transactions from our PP business account. I have code that calls NVP methods TransactionSearch and GetTransactionDetails and fills a few database tables with the results that are returned. This happens every day for the previous 24 hours' worth of transactions. So far, so good.
I began from the assumption that the same information available via manual CSV export via the PayPal web interface would be available via the API, but I'm now discovering that either this is not the case, or there is another API call I should be making to get the rest of the information I need.
In particular, GetTransactionDetails doesn't seem to return the equivalent of CSV field "Reference Txn ID" and, in a few cases, I can't see how to connect related transactions.
So, my question is how can I obtain the reference transaction ID, or how do I otherwise connect these associated transactions?
Example 1
This is (probably) the most common sort of situation where the reference transaction ID is needed.
Depending on the buyer's funding source, you may either see a purchase complete instantly or, if the transaction must be cleared, complete across three separate transactions:
The original payment, detail of which gives buyer's name, email, address, invoice number, item ID, gross, fee and net amounts etc.
followed immediately by a debit of the net amount
followed, in a few days, by a credit of the net amount.
It is crucial to match the three transactions because you don't know whether the payment will succeed or be declined (and therefore whether you've actually got the money) unless you do.
In the data I have available to me at the moment, there is only one such example of this situation, and calls to GetTransactionDetails for the settlement transactions fail completely ("The transaction could not be loaded") — possibly because, in that one instance, I know that the payment was made with a credit card by somebody who doesn't have a PayPal account.
This might be an anomaly, or it might be the common case. I have seen this triplet of transactions quite frequently in other PayPal accounts, but not this one, so I can't be sure.
Example 2
A payment in a foreign currency will typically generate three transactions, rather like in Example 1:
The original payment (eg in €), the detail of which gives the sender's name and email address etc;
this is then followed by an immediate debit of the (probably net) amount in €
and then an immediate credit in USD.
From the point of view of the NVP API, GetTransactionDetails usually returns values labelled SETTLEAMT and SETTLEAMTCURRENCYCODE for the original payment. No further processing is required.
However, a recent such transaction (for reasons that even PayPal could not adequately explain) did not auto-convert, and the GetTransactionDetails call lacks the settlement values even after the conversion was performed manually.
The transactions are all there — but I cannot see any programmatic way to associate them because an attempt to call GetTransactionDetails on currency conversion transactions returns the error "You can not get the details for this type of transaction".
—
Any advice or experience relating to automatic processing of PayPal transactions? Is there any way to duplicate, programmatically, the same data included in the CSV export?
If necessary, I'd be happy to process the CSV export if there were some way to generate it programmatically, but I don't even know of a way to do that (short of a Selenium-driven solution full of pitfalls).
GetTransactionDetails will include a PARENTTRANSACTIONID if there is a related transaction. For example, a refund transaction would have a parent transaction ID.

PayPal REST Subscriptions API not showing price in order summary

I am testing the PayPal REST API for subscriptions in the sandbox environment, and have noticed that, when going to the approval URL returned after creating an agreement, no price is shown under the order summary pane on the left of the page. A description is shown but no price/tax etc.
The plan id is passed to the call to create an agreement, which contains the information that I would expect to see as a user when approving the payment. Is this a bug or is there something that I am supposed to enable in the merchant account, or perhaps something additional that needs to be sent when creating the agreement? I've read other posts regarding this on stack overflow (although they predate the creation of the subscriptions REST API) talking about passing a transaction field, but this isn't valid in the subscriptions create agreement schema.
Your observations are (currently) correct. As REST API based Billing Plans are based on Express Checkout Recurring Payments, you're going to see a similar behavior.
Right now, there are two options:
You populate the description with more agreement details.
You pass a regular description and make sure the customer is aware of the billing terms before your execute the agreement.
Going forward, we're likely going to include this info in some later updates. I'm following up with that to make sure a user story is filed for this.

Get transaction by invoiceId in paypal api

I'm looking for the correct endpoint to use in the Paypal API for looking up a transaction by invoice id. We submit the invoice id to paypal when redirecting customers to PayPal for payment on their site. In order for us to resolve abandoned carts correctly, I need to look these invoice ids back up in paypal to see if there are completed transactions or not. Thanks.
You can use the TransactionSearch API, and use the INVNUM as the criteria to search by. The API Endpoint will depend on if you are trying this on live or sandbox, what type of format you are using, and what type of authentication you are using. You can find a list of the endpoints here.