Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I am using contact form 7 plugin in my blog.I am having donate option in the form with price option in radio button. user can select and submit.After submitting the form it should redirect to the paypal. with selected price .

i tried

on_sent_ok: "location = 'https://www.sandbox.paypal.com/us/cgi-bin/webscr?cmd=_xclick&business=xxxx@india.com&currency_code=USD&amount=100&return=http://http://cratecreative.com/norpac&item_name=contribution';"

in additional option in form management. But here value of price is static . I need to change that value what user selects.

Thanks in advance

share|improve this question
add comment

2 Answers 2

up vote 2 down vote accepted

First change the `on_sent_ok' to:

on_sent_ok: 'my_redirect();'

then create that my_redirect() function in the page that displays the form:

    function my_redirect() {
        var price = document.getElementById('PRICE_FIELD').value;
        var url = 'https://www.sandbox.paypal.com/us/cgi-bin/webscr?cmd=_xclick&business=xxxx@india.com&currency_code=USD&amount='+price+'&return=http://http://cratecreative.com/norpac&item_name=contribution';
        window.location = url;

and done! Just make sure that you correct the email in that url and replace PRICE_FIELD with the actual id of the price field.

share|improve this answer
Thanks for the reply, where should i place the script in plugin or theme files. –  gowri Jun 14 '11 at 9:46
Thanks i got it. –  gowri Jun 14 '11 at 14:44
add comment

This whole code goes in the additional settings box, changing the "xxxx@example.com" to your Paypal email and the "amount=100" to your own amount ex-"amount=25" or "amount="50". Also be sure to change the "return" page to your own URL once they complete the payment:

on_sent_ok: "location = 'https://www.sandbox.paypal.com/us/cgi-bin/webscr?cmd=_xclick&business=xxxx@example.com&currency_code=USD&amount=100&return=http://http://cratecreative.com/norpac&item_name=contribution';"
share|improve this answer
add comment

protected by Community Apr 12 '13 at 10:27

Thank you for your interest in this question. Because it has attracted low-quality answers, posting an answer now requires 10 reputation on this site.

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.