Hi @psasso
I hope you’re well today!
Currently payment description/additional custom information can only be added to Stripe payment field but not PayPal.
This is a feature planned to be added in future but I don’t have ETA>
As a workaround, you could use a bit of additional custom code. You can find it here:
https://gist.github.com/wpmudev-sls/5aa865cd8cb9f2505a2f258569178ae2
To add it to the site:
– download ZIP file and extract it to your local drive
– upload the “forminator-paypal-payment-description.php” file from inside that ZIP to the “/wp-content/mu-plugins” folder of your site’s WordPRess install
– and then edit the file
a) in this line of the code
if ( $form_id == 6 ) { //Please change the form ID.
replace number 6 with an ID of your form; form ID is the number you can see in form’s shortcode
b) in this line
$request['purchase_units'][0]['description'] = "Your description goes here";
you can set your custom description that would be passed over to PayPal.
Best regards,
Adam
Thread Starter
psasso
(@psasso)
THANK YOU! I will try it. But I do have one question:
Can I use this for more than one form?
Obviously, if I had only one form, that would be easy.
Hi @psasso
The code that I shared is for a single form only. If you want to use it for multiple forms and set different descriptions for different forms, it should be slightly modified. This version should do the trick:
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
add_filter( 'forminator_paypal_create_order_request', 'wpmudev_add_description_paypal', 10, 2 );
function wpmudev_add_description_paypal( $request, $data ) {
/* set Form IDs and descriptions below, following example format;
on the left - it's a form ID
0n the right - it's purpose description;
note that last line doesn't have comma at the end */
$purposes = array(
'6' => "Description for form ID 6",
'123' => "Purpose for form ID 123"
);
$form_id = !empty( $data['form_id'] ) ? $data['form_id'] : '' ;
if ( array_key_exists( $form_id, $purposes ) ) {
$request['purchase_units'][0]['description'] = $purposes[$form_id];
}
return $request;
}
Note that this should be used instead of the one I shared previously and it has slightly different configuration – you would set form IDs and descriptions all in this part
$purposes = array(
'6' => "Description for form ID 6",
'123' => "Purpose for form ID 123"
);
Best regards,
Adam
Hi @psasso,
Since we haven’t heard from you for a while. I’ll mark this thread as resolved for now. Please feel free to open a new thread if you have new queries.
Kind Regards
Nithin
Thread Starter
psasso
(@psasso)
Adam helped me pass through a description from Forminator to PayPal in this post:
https://ww.wp.xz.cn/support/topic/transfer-payment-purpose/#post-17846569
Can you please help me do the same with a Stripe payment?
Thank you!
Hi @psasso
In Stripe you can already set that directly in field.
Please edit the Stripe field on your form and look into “Advanced” tab. You’ll find “Payment Details (optional)” option there where you can set statement decipher and/or payment description (for this one you can also use data from the form field).
https://app.screencast.com/8lA52BUKh2MTp
There’s also option to add custom meta data if you need them.
Best regards,
Adam
-
This reply was modified 1 year, 10 months ago by
Laura - WPMU DEV Support. Reason: initially posted nearly empty response by mistake