CyberSource: Retrieve Capture Token from PayPal Transaction Details - paypal

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

Related

API errors out if I try to look up an order or payment that is completed. How can I get a definitive status of a payment?

I have the following flow with Paypal:
I create a payment with intent "order", and I redirect the user to Paypal's website.
Once the user returns, I execute the payment.
Then, I authorize the order.
At this point, I can still look up the payment or the order and I get expected result.
Finally, I capture the order.
After I capture the order, I can't lookup the payment with /v1/payments/payment/PAY-XYZ or retrieve the order with /v1/payments/orders/O-ABC. I get a 500 Internal Service Error.
Before you tell me to send debug id to Paypal because I stumbled upon their bug: I tried, but they are not responding. I had them on the phone, sent support requests, etc. I got no reply from them, so I have to turn to community.
After capture, I can still lookup a payment by listing payment resources. Since I store paypal's create time, I send a GET request that looks like:
/v1/payments/payment?start_time=2016-06-21T09:08:56Z&end_time=2016-06-21T09:08:58Z
Sure enough, I can get the payment object back, but that looks awfully hacky to me.
The reason why I need the entire payment object is because I need a definitive information about the status of the payment. E.g. I can stumble upon a network error when I send a capture request and I won't get capture ID, so I can't check what's going on. Or I can miss a webhook event (for any reason, e.g. bug in my code), and the payment can become refunded without me knowing, so it would be ver nice to be able to fetch a payment.
I noticed the REST API documentation here https://developer.paypal.com/docs/api/payments/#payment_get says that I should use that endpoint for incomplete payments, but I don't understand why I can't check the order, or why list payment resources works, but fetching a single payment doesn't.
Retrieving the payment used to work though, so I could look up related_resources of transactions of the response (like I can do now with listing all payments by date).
My question is: what is the recommended way to get the definitive information about a payment?
Also, if someone from Paypal is reading this, here are some debug_id's so you can perhaps look into it: 3ffa3007a7561 (result of https://api.sandbox.paypal.com/v1/payments/orders/O-3PA36862ST053572T) or 85576d66784cd (response from https://api.sandbox.paypal.com/v1/payments/payment/PAY-7N237030X85089344K5UQIKI)
This happens on both sandbox and live.
Thanks,
Dejan

Paypal REST API Process

Please correct me if I am wrong regarding my understanding about Paypal Rest Api process.
In reference to the links below:
https://developer.paypal.com/docs/integration/direct/create-billing-plan/
https://github.com/paypal/PayPal-node-SDK/blob/master/samples/subscription/billing_plans/create.js
I came up to a conclusion that in order for the paypal api to work, the merchant must create:
A custom button
The button must create a request to paypal in other words the merchant must manually fill out the JSON object stated on:
https://github.com/paypal/PayPal-node-SDK/blob/master/samples/subscription/billing_plans/create.js
with the merchant's product info.
Pass the request to paypal
Store the paypal response to your database.
Please advise, there are too few information out there. Thank you.
I figured it out, my question above is confirmed except that you need to active the created billing plan.
https://developer.paypal.com/docs/integration/direct/create-billing-plan/#activate-the-billing-plan

Is PayPal REST API still lacking an equivalent of GetExpressCheckoutDetails?

We are doing a new PayPal Express integration for an ecommerce store that needs to retrieve the Billing and Shipping Address information after the user logs into PayPal to authorize the payment, but BEFORE we capture the payment.
We need that information so we can create a user account in our store for them, if one does not already exist for them, and so we can properly calculate the shipping charges for the customer.
The following post over a year ago implied that had not been implemented into the REST API yet. Is that still the case?
PayPal REST API equivalent of GetExpressCheckoutDetails
If it has been implemented, would somebody please point out to me how to access that information? If so, I would greatly appreciate it.
If it has not been implemented, does anyone know when it will be implemented?

How to test a PayPal capture API call with Sandbox

I have setup PayPal Sandbox test accounts, a Personal (buyer) and a Business (merchant).
I'd like to test a PayPal 'DoCapture' API Operation. The problem I'm encountering is that I need an AuthorizationID and don't know how to obtain it. If i run the 'DoExpressCheckoutPayment' API call, I do not get an AuthorizationID returned, using the merchant API credentials, though I do get an 'ACK' of success. Do I need to be using the buyer credentials with the 'DoExpressCheckOutPayment' call? I don't see the API credentials in the PayPal Sandbox profile for the Personal account.
Express Checkout example with authorization and capturing you can find here.
Short answer - according with DoCapture documentation
AuthorizationID ... This is the transaction ID returned from DoExpressCheckoutPayment...
According with DoExpressCheckout documentation you need field from response, attention, PaymentInfo#TransactionId
... this value is your AuthorizationID for use with the Authorization & Capture APIs.
This is what you need to do to implement the capture API.
Create Payment: set intent as authorize in its request to get payment Id
Show Payment Details: to get approval_url. The customer will use this URL to pay for the order.
Execute approved PayPal payment: Use this API after customer successfully pays for the order. This API returns authorization-id along with capture link.
Use Capture API: use the URL obtained from step 3 to capture.
Use this link and check payments API.
https://developer.paypal.com/docs/api/payments/#payment_execute
Hope this helps to someone who stumbles upon here.

Get payment history on Paypal API

I need to find a way of getting a Paypal account holders payment history using the Paypal api. If we have a user's consent (i.e. we've already used the Permissions API to redirect them to Paypal, and they've consented to give us permissions to get details of payments to their account), what's the next step?
I've seen a similar question here which talked about using GetTransactionDetails call, but that seems only to get details for a single transaction. Another answer mentioned the Payment.List method, but didn't give an example of how it's used.
Can anyone point me in the right direction?
I would recommend using the TransactionSearch API. This will let you get a list of transactions (up to 100 at a time). You can then use the GetTransactionDetails API to get more information on individual transactions.
https://developer.paypal.com/webapps/developer/docs/classic/api/merchant/TransactionSearch_API_Operation_NVP/