i’m using a WordPress CF7 form that redirects to a Paypal form on form submit, using the Additional Settings. I’ve added a function in there that works well. At the same time, a new post is created using the info from the CF7 form. So, the post is created whether or not the Paypal is paid or not.

on_sent_ok: 'my_redirect();'

How would i go about adding the new post ONLY after and if the Paypal is paid. Can i pass the form values through to Paypal then send them back for submission if payment is successful.

<script>
function my_redirect() {
 var price = document.getElementById('total').value;
 var taxed = document.getElementById('taxed').value;
 var revised = (parseInt(price)/100) * parseInt(taxed);
 var url = 'https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=EMAILHERE&lc=GB&item_name=PRODUCTNAMEHERE&amount='+revised+'&currency_code=GBP&button_subtype=services&no_note=0&bn=PP%2dBuyNowBF%3abtn_buynowCC_LG%2egif%3aNonHostedGuest';
    window.location = url;
    jQuery("#totals").val(revised);
 }
</script>

Not really sure where to start using the basic button/email solution given by Paypal.

Thanks for your help!

Read more here: Paypal Button and CF7 Form


Solution:

If you know the solution of this issue, please leave us a reply in Comment section, to update the question.


Wordpress related questions and answers: