title: PayPal button sending custom variable through IPN
body: <p>I have tried to go through the jungle (really, PayPal, why don't you weed it out...) for a few days now to find the solution to my pretty simple problem.</p>
  
  <p>I have a website with membership subscriptions.
  The customer signs up with their email and password on my site.
  Then they go to PayPal to pay their subscription.</p>
  
  <p>My problem is how do I pass on the key - <strong>their email</strong> - through the whole transaction so I know who the payment is for?</p>
  
  <p>This because it is likely to happen that they sometimes sign up with one email and pay with another.
  And how to do it all with a (safe) encrypted button.</p>
  
  <p>What I figured is that I could make the encrypted button on the PayPal "<strong>Create PayPal payment button</strong>" page.</p>
  
  <p>In <strong>Step 3</strong>, Add (x-ed out real url) advanced variables:</p>
  
  <pre><code>notify_url=http://xxxxxxxxxx.com/xxxxx.php
  test_ipn=1
  </code></pre>
  
  <p>Get the code:</p>
  
  <pre><code>&lt;form action="https://www.paypal.com/cgi-bin/webscr" method="post"&gt;
  &lt;input type="hidden" name="cmd" value="_s-xclick"&gt;
  &lt;input type="hidden" name="hosted_button_id" value="N6UMVCMXSWMYG"&gt;
  &lt;input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_buynowCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!"&gt;
  &lt;img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1"&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>and paste the given code into my php page, but add a hidden field named "<strong>custom</strong>" and give it the email at hand and change the form action to go to the <strong>sandbox</strong>.</p>
  
  <p>Sort of like this:</p>
  
  <pre><code>&lt;form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post"&gt;
  
  &lt;input type="hidden" name="custom" value="&lt;?=$signUpEmail ?&gt;"&gt;
  
  &lt;input type="hidden" name="cmd" value="_s-xclick"&gt;
  &lt;input type="hidden" name="hosted_button_id" value="N6UMVCMXSWMYG"&gt;
  &lt;input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_buynowCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!"&gt;
  &lt;img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1"&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>This custom variable I can later pick up on my ipn page so I know who the membership is for..</p>
  
  <p>Am I thinking right?
  Or should I do the button with "handwritten" code?
  Or is there some better way?</p>