PayPal Transaction ID in email notifications

Hi there, I am trying to replicate the solution here with no luck:

I’ve added {transaction_id} and the form is set to “Payment Completed”

Do I still need to add this function?

add_filter('gform_replace_merge_tags', 'replace_transaction_id', 10, 7);
function replace_transaction_id($text, $form, $lead, $url_encode, $esc_html, $nl2br, $format) {

	  $custom_merge_tag = '{txn_id}';

	  if(strpos($text, $custom_merge_tag) === false)
	    return $text;

	  $transaction_id = $lead["transaction_id"];
	  $text = str_replace($custom_merge_tag, $transaction_id, $text);

	  return $text;

I recommend trying the newer merge tags listed here:


Be sure the Notification Event is set to “Payment completed”. If you have any trouble, please let us know, or open a support ticket:

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.