Tips and Tricks HQ Support

Support site for Tips and Tricks HQ premium products

  • Home
  • Contact Us
  • Documentation
  • Forum Home
    • Forum
    • Forum Search
    • Forum Login
    • Forum Registration

How to get buyer's name and email address to be used in PHP code

by

Tips and Tricks HQ Support Portal › Forums › WP eStore Forum › How to get buyer's name and email address to be used in PHP code

  • This topic has 12 replies, 3 voices, and was last updated 6 years, 9 months ago by ec999.
Viewing 13 posts - 1 through 13 (of 13 total)
  • Author
    Posts
  • August 18, 2018 at 8:32 pm #15033
    ec999
    Member

    Hello

    I want to sell computer programs as digital downloads. However, each program needs to be activated with a unique activation code specific for the buyer. The buyer’s name is needed to make the activation code, which will be made automatically using PHP code on the Thank You return page.

    After the PayPal payment, eStore receives the transaction data including the buyer’s name and email address. I need all this data. How can I obtain the data as variables I can use in the PHP code?

    Thank you very much in advance.

    Best regards

    August 19, 2018 at 3:59 am #78367
    admin
    Keymaster

    Its better to hook into it after the IPN notification is received (instead of the thank you page). The IPN is a guaranteed event where as the thank you page event is only triggered if the customer doesn’t close the browser before they get to the thank you page.

    You can use the following action hook get notified everything an order is processed by estore (after it receives the IPN notification)

    eStore_product_database_updated_after_payment

    Below is an example snippet of code:

    add_action( 'eStore_product_database_updated_after_payment', 'my_custom_code', $ipn_data, $cart_items );

    function my_custom_code ($ipn_data, $cart_items) {
    //The $ipn_data, $cart_items arrays contain all the useful data.
    //Do something with it.
    }

    August 20, 2018 at 8:14 pm #78368
    ec999
    Member

    Thank you for your response. I think that is just what I need to be able to do what I want.

    However, since I have no experience in going into the code of wordpress plugins, I would be happy if you could give me slightly more details – especially in regard to where I should place the above code supplemented with my own extra code.

    I do have some experience in PHP coding, but my computer programs are made using PowerBasic for Windows.

    Thanks again. So far my experience with eStore has been great. Really a fine plugin!

    August 21, 2018 at 3:59 am #78369
    admin
    Keymaster

    That is something you will need to handle using the following. I will need to understand what your setup is, what you want the code to do etc.

    https://support.tipsandtricks-hq.com/need-custom-work-done

    August 22, 2018 at 4:33 pm #78370
    ec999
    Member

    Thanks for your response.

    I just found “3rd party integration” in the settings section.

    If this is activated then eStore will post the IPN(instant payment notification) to the URL specified. I think that would be a good solution for me.

    Could the information that I need then be obtained by using the code you provided in your first response? Or is another approach needed?

    Thanks.

    August 23, 2018 at 4:11 am #78371
    admin
    Keymaster

    Normally, you would forward the IPN notification to a 3rd party script. Like a PHP script that you have somewhere (on your site or on an external site).

    The action hook is something that you can use from a custom plugin’s code. Usually, it is better to add customization via a small custom plugin.

    August 24, 2018 at 8:07 pm #78372
    ec999
    Member

    Yes, I think you are right. A custom plugin using the action hook you provided in your first reply would be the best. I will go for that solution. Thank you.

    August 31, 2018 at 7:12 pm #78373
    ec999
    Member

    To get the information of the sale I tried to send the information via email to my self using the following code:

    add_action( ‘eStore_product_database_updated_after_payment’, ‘my_custom_code’, $ipn_data, $cart_items );

    function my_custom_code ($ipn_data, $cart_items) {

    //The $ipn_data, $cart_items arrays contain all the useful data.

    //Do something with it.

    $message = $ipn_data . ” *** ” . $cart_items;

    $message = wordwrap($message, 70, “rn”, TRUE);

    $message = str_replace(“n.”, “n..”, $message);

    $header = “from:sender@email”;

    $subject = “sales data”;

    $to = “receiver@email”;

    $mail_sent = @mail($to,$subject,$message,$header);

    }

    However the mail produced only the following: ***

    i.e. $ipn_data and $cart_items seemed to be empty variables. Can you explain that? Thanks in advance for your response.

    P.S. I have inserted my PDT Identity Token in the PayPal settings.

    September 5, 2018 at 10:55 am #78374
    ec999
    Member

    I wonder if you have seen my previous post? Can you help me? Thanks

    September 6, 2018 at 4:19 am #78375
    admin
    Keymaster

    The $ipn_data and $cart_items are array variables. You can’t just put them in a string like the way you have it. Arrays can’t be printed that way. Do a google search to learn how you can add an Array’s content to a string (that should be helpful for you). It is beyond the scope of this forum to provide help on the understanding of PHP coding. Since you are not a PHP coder, please hire a freelancer coder to do your customization.

    September 6, 2018 at 7:18 pm #78376
    ec999
    Member

    Using implode to transform the arrays to a string as shown below does not make any difference. The result is still ***. The arrays seem to be empty.

    add_action( ‘eStore_product_database_updated_after_payment’, ‘my_custom_code’, $ipn_data, $cart_items );

    function my_custom_code ($ipn_data, $cart_items) {

    //The $ipn_data, $cart_items arrays contain all the useful data.

    //Do something with it.

    $message = implode(“*”,$ipn_data) . ” *** ” . implode(“*”,$cart_items);

    $message = wordwrap($message, 70, “rn”, TRUE);

    $message = str_replace(“n.”, “n..”, $message);

    $header = “from:sender@email”;

    $subject = “sales data”;

    $to = “receiver@email”;

    $mail_sent = @mail($to,$subject,$message,$header);

    }

    September 6, 2018 at 9:13 pm #78377
    wzp
    Moderator

    @ec999 — Where you define & insert the custom code hook & function matters. As @admin pointed out; “It is beyond the scope of this forum to provide help on the understanding of PHP coding. Since you are not a PHP coder, please hire a freelancer coder to do your customization” …or take him up on the custom work order option:

    https://support.tipsandtricks-hq.com/need-custom-work-done

    September 7, 2018 at 7:00 pm #78378
    ec999
    Member

    Thank you! I will find another solution to what I want to accomplish. I will not bother you any more with my questions.

  • Author
    Posts
Viewing 13 posts - 1 through 13 (of 13 total)
  • You must be logged in to reply to this topic.
Log In

Forum Related

  • Forum Home
  • Forum Search
  • Forum Registration
  • Forum Login

Support Related Forms

  • Contact Us
  • Customer Support
  • Request a Plugin Update
  • Request Fresh Download Links

Useful Links

  • Plugin Upgrade Instructions
  • WP eStore Documentation
  • WP eMember Documentation
  • WP Affiliate Platform Documentation
  • Tips and Tricks HQ Home Page
  • Our Projects

Quick Setup Video Tutorials

  • WP eStore Video Tutorial
  • WP eMember Video Tutorial
  • WP Affiliate Platform Video Tutorial
  • Lightbox Ultimate Video Tutorial

Our Other Plugins

  • WP Express Checkout
  • Stripe Payments Plugin
  • Simple Shopping Cart Plugin
  • Simple Download Monitor

Copyright © 2025 | Tips and Tricks HQ