Home > other >  Paypal JavaScript SDK with IPN
Paypal JavaScript SDK with IPN

Time:02-10

I am using PayPal JavaScript SDK. Now I want to add Instant Payment Notification (IPN) as I have done with just the quick checkout button. There I have used it in a form with POST like this:

<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="notify_url" value="<?php echo $HTTP_DIR."method/paypal/ipn.php"; ?>">

How I can use "notify_url" with the JS SDK? I did not find it as a parameter.

Is it enough to set up in the PayPal account where I can set an IPN URL?

CodePudding user response:

IPN is a separate 20 year-old system, not needed for current API-based integrations. Rather than using IPN with that SDK, change to a server-side create/capture with it. Then you'll have an immediate notification of successful payments, with no need to wait for a separate IPN message that may fail.

See the optional bullet #5 of the 'Add and modify the code' section of Integrate Checkout, which links to a demo code sample. You'll just need to create two routes on your PHP server that return JSON, one to create an order when a button is clicked, and the other to capture it after an approval.

  •  Tags:  
  • Related