The current version (1.24.1) of Forminator form builder for WordPress does not set a payment description for Paypal transactions. This is a problem for my client, because they need to know where the money comes from. So I create a custom solution. You can find a link to my solution, a WP mu-plugin below. If you use it please leave a comment on this blog post.
There are 2 different solutions mentioned in the Plugins Support Forum. More on that later. But they are not what I want.
What I want, is for the payment description to be set to the name of the form, by default, without requiring additions steps or settings. Having to remember extra steps every time I set up a form is problematic, when I don’t set forms up very often. It’s just too easy for me to forget.
My solution is a WordPress Must Use Plugin, like the others. Since a Form’s Name is not available in the backend on the form submit, I grab the forms URL. The URL can be used to produce a string very similar to the form name. Close enough so my client can review the PayPal transactions and see which form the money comes from.
You can get a copy my solution called forminator-paypal-description-from-url.php
, a WordPress mu-plugin from Github, here:
To install it, just copy the forminator-paypal-description-from-url.php
file to your /wp-content/mu-plugins/
folder. If you don’t have a /mu-plugins/
folder, just create one under /wp-content/
forminator-paypal-description-from-url.php
runs every time the user clicks the PayPal payment button in Forminator. It grabs the URL, shorten it to just the path, and cleans it up a bit. Then the description is added it to the Orders purchase_units
.
For example, the payment form at https://kimballrexford.com/trailsnh-sticker-shop/ will product a description of “Trailsnh Sticker Shop”. The resulting Orders purchase_units
look like this:
{
"intent": "CAPTURE",
"purchase_units": [
{
"amount": {
"currency_code": "USD",
"value": "18.20"
},
"description": "Trailsnh Sticker Shop"
}
]
}
More about the PayPal API Orders spec can be found at https://developer.paypal.com/docs/api/orders/v2/
If you use forminator-paypal-description-from-url.php
please leave me a comment below. Thanks.