Paypal Button and CF7 Form

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.

function my_redirect() {
 var price = document.getElementById('total').value;
 var taxed = document.getElementById('taxed').value;
 var revised = (parseInt(price)/100) * parseInt(taxed);
 var url = ''+revised+'&currency_code=GBP&button_subtype=services&no_note=0&bn=PP%2dBuyNowBF%3abtn_buynowCC_LG%2egif%3aNonHostedGuest';
    window.location = url;

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

Leave a Reply

Your email address will not be published. Required fields are marked *