How to check Payment failure for Paypal Express Checkout - paypal

We are using Paypal recurring billing service (using Express Checkout) at our website for monthly subscription.
Since we have an Australian account so we are not able use the DPRP (Direct Payment Recurring Payment) service offered by Paypal because it seems, DPRP service is limited
to only few countries (US, UK and Canada).
In Express checkout payment details are received at Paypal Website. So we do not have any information, whether the payment failed, user pressed the Back button in browser or He/She intentionally clicked the cancel payment.
After speaking to Paypal support team we get know that there could be multiple possible reason for Payment failure, and seller has to contact Paypal by themself. So we can
not provide any troubleshooting for that at our website.
So we want to know, Is there any possible solution to avoid this or atleast can we diffrentiate between the user for whom payment failed and who intentionally moved to
our website back without doing payment because this way we are not only unable to followup with them but also loosing a part of the customer base, interested in our service.
Any help in this is Appreciated.
Thanks

You should implement the Pay Pal IPN (Instant Payment Notification).
You configure the IPN url address on your PayPal merchant account settings. This page is simple HTML page with server-side programming that is listening for requests coming from PayPal.
There's no need to do something extra in the checkout process for making IPN work. Once you set this up, it will automatically work.
Every time something happens with a transaction in your merchant account, e.g. transaction completed/failed/canceled, PayPal will send an HTTP Post to your IPN listener URL.
Here you can get all the relevant information about the transaction, like the payer ID, the payment status. With this information you can decide what to do with your customer's order.

Related

Paypal checkout for marketplace where buyer pays seller directly

I am running a marketplace for video games. When a buyer buys an item they can directly pay the seller through Paypal by setting the 'business' variable to the Paypal account of the seller in the link that will send the buyer over to Paypal to complete the purchase.
While this works most of the times, there are downsides to this approach as the website fully depends on receiving the IPN of the transaction. In very rare cases, Paypal fails to send the IPN (server logs show that there was no such request to the listener script – even hours later).
Is there a way to integrate a direct payment from buyer to seller where the website immediately gets feedback that the purchase has been completed (via JS-API or similar), so the website does not only depend on the IPNs?
I have seen a few similar questions on StackOverflow, but the solutions mentioned in answers have been deprecated as far as I can see (Adaptive Payments are no longer supported for new projects).
Integrate PayPal checkout with a server-side pattern. Here is the front-end UI: https://developer.paypal.com/demo/checkout/#/pattern/server , which will call two routes on your server.
Those routes will in turn call the PayPal API to 'Set Up Transaction and 'Capture Transaction', respectively: https://developer.paypal.com/docs/checkout/reference/server-integration/
The above has no dependency on asynchronous IPN or webhooks.
Since the buyer will be paying the seller and not your account, you can use the custom 'payee' object to specify this: https://developer.paypal.com/docs/checkout/integration-features/custom-payee/

How can I prevent merchants from capturing pending Paypal authorizations?

We're running a marketplace with merchants that sell services to customers. Payments go directly from the customer to the merchant, and our server facilitates this, through the Authorize & Capture mechanism in Paypal Express Checkout.
In checkout, when the customer's Paypal is authenticated an authorization is created, and at the end of the interaction with the merchant the payment is captured by our server on behalf of the merchant.
There is, however, a back door enabling the merchant to intervene directly on Paypal and to capture the funds in the pending authorization before the order is completely delivered. We'd like to prevent that, or at least insert a notice somewhere in the merchant's Paypal account not to capture the payment, and to instead let our server do that for them when the order is delivered. Any ideas?
Normally, you can't do that. But you can read IPN Paypal message to know if transaction are effectives. Take a look to Paypal IPN Guide, retrieve informations and compare to your informations database transaction to check if all is right.

Not Receiving PayPal IPN With Invoicing API

On the introduction of PayPal Invoicing API documentation it states that.
PayPal sends IPN messages for invoice payments and for invoices
cancelled by the buyer.
But I've found this is not the case. IPN for invoice payment, cancel or other operation never get sent from PayPal (I have checked and confirmed it from IPN history page).
Worth Mentioning
Invoices are being created via Invoicing API successfully without any warning.
I am working on Sandbox and Creating for Third Party Merchant.
I do understand that paypal doesn't send IPN for api operation changes.
The IPN listener is working fine and I have successful implementation for subscription api with IPN.
Update
Today I tried the whole process with Live PayPal account other than sandbox account and I still not getting any IPN. So, I guess I am doing something wrong or Invoicing API is broken (which I highly doubt).
Which also makes me wonder about some additional questions:
I (merchant #1) has the permission information form merchant #2 for sending invoice to their behalf.
I have setup IPN to my IPN listener URL.
merchant #2 do not have IPN setup to my listener URL.
So, when Invoice that I created for merchant #2, Do I get IPN?
OR, merchant #2 also needs to setup their IPN url pointing to my listener URL?
IPN is get send from the account that receiving payment as #effone mentioned in comment. So, it seems I was confused from paypal documentation.
Answer: The IPN url from merchant #2 will need to setup in order to get notification about invoice payment. merchant #1 account who sending the invoice behalf of merchant #2 will not send any IPN as the payment isn't involves merchant #1
Way I see it, this is not a proper solution to create an invoice management system. As if I have 1000's of user they all need to set their IPN url to mine in order to get the application work correctly (aka, setting invoices as paid when they gets paid)
Your question reads strangely, because you say the IPN is working fine, then in your update, you say you're trying it in your live PayPal account. It sounds like it's working on the Sandbox, but not in production?
If this is the case:
Did you activate the IPN under your Production (Live) Paypal account?
Do you have the IPN URL for this?
Are you seeing the IPN being logged under the Production (Live) PayPal site?
If No -> it's been a while since I've worked with this, but there used to be an interface where you could send an IPN test- have you tried that?
If Yes -> make a bare bones listener- just a page that logs that it was hit, then add logic to it.
hth

PayPal API - How to keep the payment process on my website?

I run a small marketplace with multiple sellers where buyers can buy items and pay with PayPal. The problem is, when someone makes a payment, they are then displayed the "Payment Confirmation" on the PayPal website and are given a choice to either return to their PayPal account, or return to the website.
Is there any way to keep the payment flow on my website, except for the payment part? I notice when buying on Etsy for example, the buyer goes to PayPal to make the payment and is then immediately returned to Etsy for the payment confirmation. They never see the PayPal payment confirmation page.
I assume it could be because Etsy and PayPal have a special arrangement that isn't available to other sites? Or am I missing something in the API?
Right now, with the normal PayPal API, this is what buyers see:
NAME, you've just completed your payment.
Your transaction ID for this payment is: XXXXXXXXXXXXXXXXXXXX.
We'll send a confirmation email to your#email.com
Go to PayPal account overview.
Go back to "seller#email.com".
I can't even figure out how to change the "Go back to..." link to my website name in the hidden fields. PayPal just chooses to display the seller's (the person that received the payment) email address.
Is there any way to at least set a website name for them to return to with hidden variables? Keep in mind that I have different sellers, so it's not something I could set inside each seller's PayPal account.
Thank you :)
I assume you are using Express Checkout with Set/Get/Do EC API integration. Please check the below document for experience options available with Express Checkout API.
https://developer.paypal.com/webapps/developer/docs/classic/express-checkout/integration-guide/ECCustomizing/
The 'useraction=commit' in the PayPal payment auth url triigers the 'Buy' button. If you do not send that request paramter then it will show 'continue' button and you can complete rest of the process on your site.
However, if you are using Paypal Payment Standard product then you need to use Express Checkout to accomplish the outcome you are seeking.

Checking if paypal payment was successful

I have downloaded sample code from paypal to allow me to use parallel payments via their sandbox accounts. When I run parallel.php, I get redirected to paypal's sandbox login page.
How am I supposed to know "server side" that the payment has been made successfully, so I can update my database records?
I believe you have to work with PayPals IPN system. This will basically send a confirmation to your server that tells you it has gone through.
https://www.paypal.com/ipn
Paypal lets you register a notification url which is part of the IPN (instant payment notification IIRC) system. So if someone pays by a delayed payment (such as a bank transfer) the transaction will update days later. You need to have an application (web page) on your server that can be called by Paypal with transaction details to update a payment.
You'll need to create an initial transaction record in your system when paypal redirects back to you so refer to their documentation for that. I'd also recommend looking at either OSCommerce or Zen cart for an idea of how they do it as they support the same kind of thing.