Forums

Paypal with dropdown

mcarbone 21 Mar, 2012
I have created a form for registration / subscription (not Joomla) that users must pay for. The price depends on if the person is a member of the organization or not (member price $50 and non member price is $500). I have created a Paypal button in my paypal account for the information needed to pass from my form to Paypal. I am using the redirect user and redirect URL actions, and it almost works. 😀

The form has a dropdown for the user to select if they are a member or not. This dictates the price they must pay to subscribe. The problem is when the form is submitted and then directed to Paypal, Paypal always shows the price for a non member ($500). The member price ($50) is never passed to Paypal.

I know I am missing something very small, but I have been struggling with this for a while. I've tried to search posts similar, but I cannot find my answer. It must have something to do with the redirect URL params listed below:

Target URL: https://www.paypal.com/cgi-bin/webscr

cmd=_s-xclick
hosted_button_id=XXXXXXXXXXXXX
on0=speaker_type
os0=NAWBO Member
os0=Non Member
currency_code=USD

The redirect URL action is in the on submit event area, after db save action and before redirect user action. I have made a backup of my form and attached it.

I appreciate any help on this.
GreyHead 22 Mar, 2012
Hi mcarbone ,

I haven't looked at the form but from the post here you don't appear to be passing an amount to PayPal? Shouldn't you add code to set the amount depending on the option selection?

Bob
mcarbone 22 Mar, 2012
Hi Greyhead,

The form passes the selected option value of select input "speaker_type", either member=NAWBO Member or nonmember=Non Member. Based on that variable, button id etc., Paypal determines the price. Here's code from Paypal with just the drop down and submit:

<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="XXXXXXXXXXXXX">
<table>
<tr><td><input type="hidden" name="on0" value="Speaker Type">Speaker Type</td></tr><tr><td><select name="os0">
	<option value="NAWBO Member">NAWBO Member : $50.00USD - yearly</option>
	<option value="Non Member">Non Member : $500.00USD - yearly</option>
</select> </td></tr>
</table>
<input type="hidden" name="currency_code" value="USD">
<input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_subscribeCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
<img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>


Thanks so much for helping!
GreyHead 22 Mar, 2012
Hi mcarbone,

Sorry, I over-looked the 'hosted button' code.

Maybe you just need to pass the value of os0?
cmd=_s-xclick
hosted_button_id=XXXXXXXXXXXXX
on0=on0
os0=os0
currency_code=USD

Which action are you using to send this? The Redirect URL? if so then I think that the form input names need to be in curly brackets {}
cmd=_s-xclick
hosted_button_id=XXXXXXXXXXXXX
on0={on0}
os0={os0}
currency_code=USD


Bob
mcarbone 22 Mar, 2012
Enjoy that beer!!!! I believe I named the select field wrong. 50 lashes with a wet noodle...didn't I learn from the "event" coincidence. 😀

Thanks for all your help!
This topic is locked and no more replies can be posted.