To search transaction using custom attribute in Paypal Express Checkout - paypal

Hey is there any way to look up transaction details by my Custom attribute which i passed during SetExpressCheckout call to API.
Paypal is providing transaction search by
TransactionSearch API - Which needs Startdate as param.
GetTransactionDetails API - Which needs unique Transaction ID as param. ( which is only available only if DoExpressCheckout is successful ).
Both of these do not fit my solution. Any help will be appreciated.

You can make use of the "PAYMENTREQUEST_n_INVNUM" parameter in SetExpressCheckout API call which you can set to your customized value and later can use in the Transaction search API call.

Related

Integrating PayPal Smart Payment API with old Express Checkout API

We currently have a system in place to process PayPal payments. It is done using the Express Checkout API. The method DoAuthorization accepts a 17 char TransactionID as a parameter.
I'm trying to implement the new PayPal Smart Payment Buttons API. I have the flow programmed with the intent=AUTHORIZE but I can only grab the Authorization ID and Order ID (both 17 char values) from the Auth response once its completed.
When I try and authorize the order and pass one of the 2 values into the DoAuthorization method, returns with an error: TransactionID invalid (10609).
My question is it possible to use the Smart Payments API Authorization ID and Order ID and pass it into the Express Checkout DoAuthorization method and still make the 2 systems work?
Could it be possible that I'm getting the 10609 error because the intent=Authorize already authorizes the order and I need to call the DoCapture method?
It is possible to use the SPB user interface, but not its API (actually it's built on the v2/orders REST API)
You can't mix v2/order API payment setups, with classic captures.
So, so long as you are using classic API calls to capture (this is a very unfortunate requirement that I would advise eliminating ASAP, but it's in your question) -- then, you need to also keep using classic API calls to set up the payment.
See the server demo pattern: https://developer.paypal.com/demo/checkout/#/pattern/server
The createOrder portion will do an XHR fetch to your server, which will then call the classic SetExpressCheckout and return an EC token. SPB will use the classic EC token, but show its new UI.

How can i find a transaction in paypal which is not made via rest api?

I am not able to find payment or sale object in paypal with the txn_id returned in IPN message. I want to process refund via rest api call for such transactions.
In general, you can perform a refund via REST API call only if your transaction was made via REST. Anyway, it depend of the flow that the transaction followed...
If you want provide further details, I will be more than happy to provide more information about.
Thank you in advance.

Paypal: Express Checkout custom PAYMENTREQUEST_n_TRANSACTIONID not working

TL;DR Version
According to the Express Checkout NVP Api docs I can set my own transaction ID with the PAYMENTREQUEST_n_TRANSACTIONID field. This never works for me - the response from the 'DoExpressCheckoutPayment' always returns a different transaction ID. The docs don't say if it needs to be unique (I presume that it does) or how to generate an ID that is guaranteed to be accepted as valid on Paypal's side. How do I do this?
Full Version (Read above first)
I don't really need to create my own transaction ID. If I could be sure that the my call to 'DoExpressCheckoutPayment' finishes before Paypal issues the IPN - that would be fine. This is so I could update my records from the 'PAYMENTINFO_n_TRANSACTIONID' field before the IPN is issued and then use the 'txn_id' from the IPN call to update my records.
At the moment setting a custom transaction ID at the 'SetExpressCheckout' stage is never returned at the IPN stage.
I'm using API version 98.
You can't create your own transaction ID. What you're seeing in the documentation is that the response would return the transaction ID.
DoExpressCheckoutPayment will always finish before the IPN triggers. In fact, DECP is what triggers the IPN.
If you want to pass your own custom value of some sort you'll need to use the actual CUSTOM parameter in the DoExpressCheckoutPayment request. If you include CUSTOM in SEC but not DECP, it will not be included in the final payment details, and would not be returned in IPN.

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.

Retrieving Billing Type in PayPal Express Checkout for recurring payments

I'm setting up a payment engine for a custom framework using PayPal Express Checkout. One of the business requirements is adding support for recurring payments. I've found documentation on how to implement this at https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_api_ECRecurringPayments
The thing I don't quite understand is how to retrieve the value of BillingType from the API after I've set it via SetExpressCheckout to "RecurringPayments". It doesn't seem to appear anywhere in the response data I get back from neither GetExpressCheckoutDetails nor DoExpressCheckoutPayment. I need this to know whether I need to create a recurring payments profile or not. So as far as I can tell my only option is to store the value of BillingType in my database and query it again after DoExpressCheckoutPayment. This works for me but I find it odd that this data would not be returned at all by the API. Am I missing something? Or is there another way of correctly implementing recurring payments?
Not all data you send in a request is returned in a response. You already have what you're passing to them...there's really no need for them to pass it back.
You could use session variables to save the data instead of the database, or you could log all of your API requests and refer to those logs when you need to see what you sent, but again, your application is what's telling PayPal whether or not the payment should include billing agreement information...not the other way around.