0
votes

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).

1

1 Answers

1
votes

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/