Open up the "Settings" area of your Mechanic account:
Use the "Webhooks" section to create a webhook, named "PayPal", with an event topic of "user/paypal/ipn". ("IPN" stands for "Instant Payment Notification", and it's the way PayPal supports sending out external notifications of payment activity.)
Save the webhook, and copy the resulting webhook URL. It'll look something like this:
Next, log in to your PayPal account, and then use this link to quickly jump to your IPN settings area:
(If you don't want to use this link: From the Profile menu on the top right, click Profile and Settings, then find and click on the "Notifications" link in the left-hand navigation menu. From there, you'll see "Instant payment notifications" in your available options - click on "Update" to arrive at the URL linked above.)
You'll see a screen that looks like this:
Click the "Choose IPN Settings" at the bottom. You'll then see a form asking for a notification URL, and a simple toggle asking if you'd like to receive IPN messages. Paste in your Mechanic webhook URL, and enable IPN messages:
Click "Save", and confirm on the following screen that all's as you expect. (Remember, you're using the webhook URL that you generated in your Mechanic settings! This screenshot is only showing an example.)
Next, install this Mechanic task, from our library:
Configure to taste, and you're done! :) Here's what the task options look like:
- Out of the box, this task only creates orders for PayPal events that reflect successful payments. But, IPN notifications cover all kinds of things: PayPal changes to subscriptions, changes recurring payment profiles, disputes, and more. If you'd like to do something more with IPN notifications, file a task request.
- If you'd like to do some testing, you can use PayPal's IPN Simulator. (The login button is tucked away in the upper-right corner.) This will let you try out your new task in action. If you need a hand here, use this guide from PayPal for reference. :)
There are a variety of IPN transaction types, and this task only covers a few of them. PayPal has documented the complete list, and it includes payments, auctions, mass pay, recurring payments, subscriptions, disputes, pay messages, adaptive accounts, and more.
The order import task is a good illustration of how to use incoming IPN data to form a Shopify request. You adapt that task's code for any purpose, continuing to use IPN event data.