0
votes

I'm using the PayPal standard SUBSCRIBE button. The HTML looks something like the code-snippet below. The issue is that it appears FORM parameters a1/p1/t1, a3/p3/t3, src/sra, and any other advanced HTML variables for the PayPal SUBSCRIBE button cannot be overridden. That is, they remain set to the values you configured in the standard-button configuration on PayPal's website.

QUESTION: how can I programmatically override the advanced PayPal subscription parameters from my website? Is this even possible? Thanks.

<form accept-charset="UTF-8" action="https://www.paypal.com/cgi-bin/webscr" class="signup_company" id="signup_company" method="post">
  <input type="hidden" name="cmd" value="_s-xclick" />
  <input type="hidden" name="hosted_button_id" value="MY_PAYPAL_BUTTON_ID" />
  <input type="hidden" name="currency_code" value="USD" />

  <!-- First two months of subscription are free. -->
  <input type="hidden" name="a1" value="0" />
  <input type="hidden" name="p1" value="2" />
  <input type="hidden" name="t1" value="M" />

  <!-- Recurring subscription payments. -->
  <input type="hidden" name="a3" value="29.95" />
  <input type="hidden" name="p3" value="1" />
  <input type="hidden" name="t3" value="M" />
  <input type="hidden" name="src" value="1" />
  <input type="hidden" name="sra" value="1" />

  <!-- Pass-through variable sent to paypal; it is set in javascript before the submit. -->
  <input type="hidden" name="custom" value="Evergreen::::[email protected]::::4" />

  <input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_subscribe_SM.gif"
    border="0" name="submit" alt="PayPal - The safer, easier way to pay online!"
    onclick="$(#signup_company).submit();" />
  <img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1" />
</form>
1
Sorry for replying late, and I know you already found the answer, but since I had the same problem and found the above information insufficient, I would like to add a link to the following tutorial which helped me understand and fix the problem: support.qualityunit.com/…Ynhockey

1 Answers

2
votes

After speaking with a PayPal tech, here is the how to proceed with the PayPal Standard Subscribe button, if you want maximal programmatic control over the HTML form variables:

  1. Do not save your button as a hosted button at PayPal. If you do, then overriding whatever price tiers that you have configured and saved at PayPal cannot be overridden.
  2. Do not encrypt your button. This means that when you create your Subscribe button, you should do two things: (a) use your e-mail address in the HTML form-post, rather than some merchant ID from PayPal; and (b) unprotect / unencrypt the HTML form variables generated during the button-create step.

Once you copy-and-paste the PayPal-generated HTML into your webapp, you can then rely on JavaScript event-handler to dynamically adjust the HTML form-parameters that determine the pricing / duration / etc of your subscription.