Hi mireille,
There are two possible ways to achieve this. The first way is to dynamically generate the price in the shortcode. See this thread for more information:
viewtopic.php?f=36&t=1604The other way is to use an unencrypted button and simply turn the hidden amount field into a text field that allows the user to set the price.
When you generate the PayPal button in s2Member, you'll see that you have two options: use the shortcode or use the PayPal Button Code that appears in the box at the bottom. (Keep in mind that you'll need to install and activate the
PHP Execution plugin for this method to work because the PayPal Button Code contains some PHP.)
You can copy that PayPal Button Code, paste it into a WordPress page, and then modify it slightly to show a text field for the amount instead of hiding it. You'll change this line:
- Code: Select all
<input type="hidden" name="a3" value="5.00" />
to this
- Code: Select all
<input type="text" name="a3" value="5.00" />
(Note that if you're using a Buy Now button instead of a subscription button, you'll want to change the input field named "amount" instead of the one called "a3". Also, if you have trouble getting the text field to show up, try deleting all the lines in the generated form code that start and end with
<!-- -->.)
Here's an example of what the full modified button code might look like for a Level 1 Subscription pay-what-you-want button:
- Code: Select all
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="business" value="raam@raamdev.com" />
<input type="hidden" name="cmd" value="_xclick-subscriptions" />
<!-- Instant Payment Notification & Return Page Details -->
<input type="hidden" name="notify_url" value="http://example.com/wordpress/?s2member_paypal_notify=1" />
<input type="hidden" name="cancel_return" value="http://example.com/wordpress/" />
<input type="hidden" name="return" value="http://example.com/wordpress/?s2member_paypal_return=1" />
<input type="hidden" name="rm" value="2" />
<!-- Configures Basic Checkout Fields -->
<input type="hidden" name="lc" value="" />
<input type="hidden" name="no_shipping" value="1" />
<input type="hidden" name="no_note" value="1" />
<input type="hidden" name="custom" value="example.com" />
<input type="hidden" name="currency_code" value="USD" />
<input type="hidden" name="page_style" value="paypal" />
<input type="hidden" name="charset" value="utf-8" />
<input type="hidden" name="item_name" value="Bronze Member / description and pricing details here." />
<input type="hidden" name="item_number" value="1" />
<!-- Configures s2Member's Unique Invoice ID/Code -->
<input type="hidden" name="invoice" value="<?php echo S2MEMBER_VALUE_FOR_PP_INV(); ?>" />
<!-- Identifies/Updates An Existing User/Member ( when/if applicable ) -->
<input type="hidden" name="on0" value="<?php echo S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON0; ?>" />
<input type="hidden" name="os0" value="<?php echo S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS0; ?>" />
<!-- Identifies The Customer's IP Address For Tracking -->
<input type="hidden" name="on1" value="<?php echo S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON1; ?>" />
<input type="hidden" name="os1" value="<?php echo S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS1; ?>" />
<!-- Controls Modify Behavior At PayPal® Checkout -->
<input type="hidden" name="modify" value="0" />
<!-- Customizes Prices, Payments & Billing Cycle -->
<input type="hidden" name="src" value="1" />
<input type="hidden" name="srt" value="" />
<input type="hidden" name="sra" value="1" />
<input type="text" name="a3" value="5.00" />
<input type="hidden" name="p3" value="1" />
<input type="hidden" name="t3" value="M" />
<!-- Displays The PayPal® Image Button -->
<input type="image" src="https://www.paypal.com/en_US/i/btn/btn_xpressCheckout.gif" style="width:auto; height:auto; border:0;" alt="PayPal®" />
</form>
The above code generated the following text field + PayPal button on my test site:
- Screen shot 2011-12-28 at 22.14.48 .png (11.82 KiB) Viewed 2238 times