Paypal IPN handler - paypal

Does the Paypal provides any api to retry the IPN message using message id? I need to integrate functionality similar to the "resend ipn" button available on IPN history page of paypal.

There is no API to trigger the resend of an IPN, but there are API's to obtain the details that would be included in an IPN for a given transaction, so depending on what you're doing that make work for you.
For example, the combination of TransactionSearch and GetTransactionDetails can be very useful.

Related

API callback from Paypal when there is dispute or refund

I am trying to setup a website with a backend to capture papal orders and payments using their orders API.
Everything is expected to be controlled using code so is there any way paypal will send a callback when there is a dispute or customer asks for a refund ? i.e. if there are many orders it would be hard to keep track of disputes by reading emails.
Yes, check out the PayPal API documentation. The Disputes API is what you are looking for.
Set up a webhook listener on the REST app for the events you want to listen to (specify * for all). There are events for disputes and refunds; see the list in the PayPal documentation

PayPal REST API payment id = IPN txn id

Let's assume the PayPal REST API is used to fulfill a standard PayPal payment process. When executing the payment it is returned as 'pending', so the payment is not through, yet. The REST APi provides a payment id:
https://developer.paypal.com/docs/api/#execute-an-approved-paypal-payment
When payment is completed the URL of my IPN listener is called, however as said on this site included only a txn_id which seems to be not the same as the payment id of the REST API:
https://developer.paypal.com/docs/classic/ipn/integration-guide/IPNIntro/#id08CKFJ00JYK
So how to match these two ids?
IPN was designed for supporting the classic APIs on PayPal and the txn_id would have matched the txn_id of a payment made with the classic API.
For payments made via the REST API, you may still be notified via IPN but unfortunately cannot match payments using ids currently. Your best option right now would be to check the attributes of the payment (amount, currency etc) and check that it matches attributes of a payment you were expecting.
Currently this is the existing option for push based notifications. The other option may be to poll at regular intervals and check the status of the payment.
There are certainly limitations to both approaches, and there is webhook support upcoming which would have push based notification support for REST payments to alleviate these issues.
The txn_id of IPN messages are also included with the REST API message but called 'sale id' there.

No shipping info with adaptive payments

I have been able to get a PayPal adaptive payments payment to work with a simple payment call.
But I want to get shipping details.
I have tried setting action type to create, then using the payKey returned sending a SetPaymentOptions call setting RequireShippingAddressSelection = True, then using the returned url from the payment call as before but still no shipping info.
I have seen others with this problem but without an answer.
Thanks
I have the same problem and here's what I got from PayPal Tech Support.
It is not possible for you to supply a shipping address as part of an
Adaptive Payments transaction. However, you can request that the
customer selects a shipping address from the addresses existing on
their PayPal account when they checkout using the embedded flow.
Details of the embedded flow are available here:
https://developer.paypal.com/webapps/developer/docs/classic/adaptive-payments/integration-guide/APIntro/
(Search for Embedded Payments)
If you think this is an option you would also be required to implement
another API call, SetPaymentOptions, which would be sent after the Pay
API request. Within the SetPaymentOptions API request you would add
the parameter requireShippingAddressSelection. Details of the
SetPaymentOptions API are located here:
https://developer.paypal.com/webapps/developer/docs/classic/api/adaptive-payments/SetPaymentOptions_API_Operation/
If your application requires that you supply a custom shipping address
to PayPal at the time of payment then you will need to consider using
Express Checkout instead of Adaptive Payments.
Are you sure the shipping info isn't passing? I don't think it's anything you'll see during the checkout process, but it will show up in the transaction details of the payment in your PayPal account.
I spent hours researching this and it appears to be an API bug from 2011 (great job PayPal!).
Unfortunately, you have to request the shipping info from the user before redirecting them to PayPal.
Source link

Do you need to use IPN with express checkout to confirm PayPal payments?

When I use the Checkout express API calls do I need to have an IPN listener to confirm payment?
Some places give the idea that once I receive a response from DoExpressCheckoutPayment the payment has gone through and I can take action - update the database etc.
Some posts here http://www.zen-cart.com/showthread.php?72304-Paypal-IPN-and-Express-Checkout suggests that IPN is old or outdated.
You could use either or, or you could use both. The IPN will will update your system if the buyer pays with an echeck once it clears, just as it will update your system of refunds and chargebacks. The respone from the Express Checkout API call wont do this. You would have to check manually.

Is using the PayPal IPN as a API trigger a good implementation?

As recommended by PayPal I am using a combination of the PayPal API and the IPN to create a 'Adaptive Payments' flow.
When my IPN listener receives a new notification from PayPal I have two options (after security checks):
1) Use the received data to make direct actions in my website (for example set a preapproval as approved)
or instead a more secure and clean way (I think):
2) Detect the transaction type variable (or other identifier) and request more details from PayPal accordingly.
For example if the 'transaction_type' is 'Adaptive Payment Preapproval' then I will use the received 'preapproval_key' to request the preapproval details using the PreapprovalDetails API call and then use the received data of that call to set the preapproval as approved.
Is this (option 2) the better way to go?
Thanks.
In general there is probably enough information in the IPN for you to act on, but IPNs are pretty confusing what with all the optional fields and the way that there is no payment_status or txn_id on subscribe events, and no subscription information on payment events, so marrying them up can be interesting. You may well find it easier to understand if you go ahead and get the relevant information from them for each IPN via their API as you suggest.