PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

Paypal Transaction ID on confirmation page

  1. Hello,

    Is it possible to display the transaction id after the user has returned to the site. I didn't see any options for results from Paypal in the confirmation tab.

    Are there any hooks/filters I can use to get this information displayed, if so, what other information can you display about the transaction result

    Thanks!

    Posted 9 years ago on Wednesday January 30, 2013 | Permalink
  2. I think it would be possible to get the transaction ID after the visitor returns from PayPal using an approach similar to the one I described here using a custom merge tag: http://www.gravityhelp.com/forums/topic/authorization-code-passed-to-email#post-137339

    In PayPal Standard, the transaction ID is called txn_id, so you could create a merge tag {txn_id} and use the same approach as I described there.

    It looks like all this information is available when the IPN is returned:

    [mc_gross]
    [invoice]
    [protection_eligibility]
    [payer_id]
    [tax]
    [payment_date]
    [payment_status]
    [charset]
    [first_name]
    [mc_fee]
    [notify_version]
    [custom]
    [payer_status]
    [business]
    [quantity]
    [verify_sign]
    [payer_email]
    [memo]
    [txn_id]
    [payment_type]
    [payer_business_name]
    [last_name]
    [receiver_email]
    [payment_fee]
    [receiver_id]
    [txn_type]
    [item_name]
    [mc_currency]
    [item_number]
    [residence_country]
    [transaction_subject]
    [payment_gross]
    [ipn_track_id]

    It's possible your transactions will have greater or fewer pieces of information I suppose.

    Posted 9 years ago on Thursday January 31, 2013 | Permalink
  3. Hello,

    I wasn't able to get this to work.

    The GFPayPal class does not have a $transaction_response variable. I looked through the code to see if there is anything else I was able to use but wasn't able to find anything.

    Do you have any other suggestions?

    We are creating a "Gift certificate" form and once returned would like to display the transaction id on a printable gift certificate so the company is able to check to see if the gift certificate has a valid transaction ID

    Posted 9 years ago on Thursday January 31, 2013 | Permalink
  4. I think the approach will be the same, but the variable names will be different. Something has to return [txn_id]. What did you find when looking through the code?

    Posted 9 years ago on Friday February 1, 2013 | Permalink
  5. After some more digging around and reading the code, I managed to figure out how to do this. The transaction ID was in the $lead variable used in 'gform_replace_merge_tags'.

    It was also returning null for me because I was running the site on the different port than port 80. Changed the site to port 80 and was able to print out the transaction ID with the following code. Thanks for getting me in the right direction Chris!

    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;
    }
    Posted 9 years ago on Friday February 1, 2013 | Permalink

This topic has been resolved and has been closed to new replies.