- 1 Getting data from the Paypal notification module
- 2 Getting a card in Trello with payment
- 3 Other notifications
- 4 What else you can add to the scenario
In the previous article, I described how to automatically create invoices in Paypal. In this article, I will tell you how to get notifications about payments.
Getting data from the Paypal notification module
Create a new scenario and name it, for example, Paypal Watch Payments.
This is how my whole scenario looks like:
In my case, it’s more complicated, but you need fewer modules to get things working in the beginning.
Create the first module Paypal -> New notification (Instant). This module will listen to all notifications that will come to your Paypal account.
The module will generate a Webhook URL. Copy the URL for further setup.
Next, go to your Paypal account -> Settings -> Seller Tools ->Instant payment notifications -> Update.
On the next page enable IPN and paste copied Webhook URL, save.
Now the Paypal module will receive all notifications from your account.
Let’s go back to the scenario. In my case, I need to filter out all notifications that are off-topic. I need to get notifications only related to my project.
Put a filter right after the module Paypal -> New notificaton
This filter checks if the notification contains a specific comment in the Item name. If it does, the scenario continues to run.
For example, the comment could contain the following data:
codelessman.com payment: nchfd43783bncndjn43
In the previous article, when invoicing, I recommended adding the Trello card ID to the comment, so now we able to use the card ID. We only need to cut off everything unnecessary from the comment, namely codelessman.com payment:
To do this, we use the Set variable module and the replace() function:
With replace() function we:
- look for “codelessman.com payment:”.
- replace it with an empty value.
The output is a clean Trello card ID.
Getting a card in Trello with payment
Using module Trello -> Get a card and the card ID from the previous module, we get all data for the card.
I add all payments to Google Sheets, so you can work with them further with formulas.
- If you need to add a payment to a specific row in a table, the best way is if that row already has a column with a Trello card ID. Then use the module Google Sheets -> Search Rows to find the right row with the card ID. Then create Google Sheets -> Update Row module, insert the row number from the previous Search Rows module, and insert the payment amount in the required column.
- If you need to summarize several payments in a cell (previous payments with the current one), you can use this formula in the Set variable module:
- parseNumber() – the function that takes the data from the desired cell and converts it to a digital format with a dot separator.
- Then we sum up the incoming sum with what is already in the cell.
- The obtained result can be inserted into the next modules.
Notification of refunds
Sometimes there are refunds, and this notification also comes in the module Paypal -> New notification.
To understand that there was a refund, we need to make a router somewhere and put a filter on one of the branches with the Reason code variable. I put a router after the module Trello -> Get a Card, because then you can write the refund and its amount in this card.
Refund request notification
To catch this situation, we make a new branch in the router:
Notification of a closed dispute
When a dispute is closed, catch it with the next branch in the router:
After these events, the data obtained can also be recorded in Google Sheets, send messages to Telegram, Trello, etc.
The remaining branch of the router (successful payment) can be marked as Fallback route.
What else you can add to the scenario
Post a comment in the Trello card about payments or refunds
Do it with the module Trello -> Create a Comment on a Card
Example of module settings:
And this is what it will look like in Trello:
Moving a card to a certain list
If you need to move a card to a certain list to create an invoice, then you need to move it somewhere after payment. In my case, it is the agent’s work list, for example, “Work Viktor”. In this list, an agent works on the paid orders.
To remove unnecessary actions for the agent, you can move the card right after the payment to the desired list with the module Trello -> Edit a Card:
- Choose where to move a card (board and list).
- Then we mark in which list to move: depending on who is added to the card using the switch() function. I wrote about this function here. ID lists and users can be set beforehand with the Set Multiple Variables module.
- Select the position in the list. It is better to the top, as the most recent activity.
Set status in Trello card
In the custom fields of Trello, there is a type “Dropdown list”. You can create statuses in it that show the work on the order.
As part of the automation, you can put a status immediately after successful payment. In my case, this is either Paid or Partly Paid.
You can set the status in a custom field through the module Trello -> Set a Custom Field on a Card.
To set the status, you need to know the ID of the custom field and the ID of its values. The dropdown lists each option has its own ID.
You can find out the ID of each option through the board source code or the Trello module -> Get Custom Field Options.
Send an email to a client with a successful payment
Add module Email -> Send an Email, configure and mark email body, the sender, the server. I described a little more about this module here.
At the end of the scenario, I may have variations because of the type of payment, so I use many branches in the router to set the correct status and payment type in Google Sheets, depending on several conditions. I won’t elaborate here.
This is how the Paypal payment notification scenario works. I hope this article was useful. If anything is not clear, ask questions in the comments.
I love SEO, marketing, I am passionate about automation and I hate manual work that can be delegated to machines.