Forums

submit form and pay with Paypal

Repitol 05 Feb, 2015
Hi,
I have a form that enables users to register for a ski-race, restaurant, party ...
According to the fields they choose, the form calculates the amount to be paid
At the end of the form there's a Submit button to send the form, then user is redirected to a thank-you page
I'd like to add a "pay with Paypal" Button, but how could I manage it to enable the submit button, then optionnal payment with Paypal ?
I know how to display the Paypal button, it works well. But if a user click on "Paypal", he's redirected to the Paypal payment page and we don't receive the form
If he clicks on "Submit", we have the form but he can't pay with Paypal...
:?
GreyHead 06 Feb, 2015
Hi Repitol,

Use the Redirect User action as the last action in the form On Submit event to redirect the user to PayPal with the details of the amount, etc.

Bob
Repitol 06 Feb, 2015
hello Bob,
ok but how to provide the choice : I pay with Paypal (in this case On submit event = Paypal payment)
and
I pay by check (in this case On submit event cannot be Paypal redirection)
?

Repitol
Repitol 11 Feb, 2015
Hi,
Maybe I can add some line in the Paypal plugin code to enable sending the form at Paypal button submit ?
can you tell me what to do ?
thanks
Repitol 25 Feb, 2015
Hi,
anyone can provide me a solution ? this is urgent now. Pleaaaaase.
thanks
Repitol 27 Feb, 2015
Bob,
I'm sorry but the form needs to be online and I can't got what you explain. I posted several weeks ago and have no solution.
at the end of the On Submit Event Action, I have Paypal redirect with amount calculated by the form
If I add a redirect user action at the end, there are 2 redirect actions (Paypal + user)
My aim is to receive and register the form if the user pay or don't pay with Paypal and I don't undersatnt how to do this.
I really need help.
Thanks
GreyHead 27 Feb, 2015
Hi Repitol,

The simplest way is probably to use an Event Switcher to handle the two different payment methods.

Or you could use a Custom Code action to switch between two Redirect URLs, one to PayPal, the other to the Thank YOu page.

Bob
Repitol 27 Feb, 2015
Ok thanks,
I'll try these options
that's to say submit and Paypal or submit + thank page
is it possible to have 2 submit buttons (with the name I'll choose) the user chooses ?
submit 1 = (no paypal) -> form registered in DB and thankyou page
submit 2 = (I pay with Paypal) -> form registered in DB and paypal redirect
Repitol 03 Mar, 2015
Hello Bob,
I'm a real glue pot. I don't succeed in my attempt to provide both a submit button and a "Pay with Paypal" button
when I add the Paypal button (with paypal plugin event) - user is redirected to Paypal payment with the amount calculated in the form but there's no database registration.
If I could add the paypal button to the thankyou page it would be a solution but how to do that with the Paypal plugin ?

I don't find how to use an Event Switcher if the solution is that way

thanks for any help
GreyHead 03 Mar, 2015
Hi Repitol,

Please see this FAQ for conditional actions in CFv4.

Your DB Save question (in the other thread) may be because the DB Save is after the PayPal action. The PayPal action redirects the user so nothing after that will be run - it needs to be the last action.

Bob
Repitol 03 Mar, 2015
When I use Paypal redirect as last action, I have another problem. User must choose Paypal button to validate the form
If he chooses Submit button (he doesn't want to pay with Paypal) he is redirected to Paypal payment too.
I've tried to put it at the end but unfortunately no form is registred. 😟
GreyHead 03 Mar, 2015
Hi Repitol,

When I use Paypal redirect as last action, I have another problem. User must choose Paypal button to validate the form

That makes no sense to me :-(

The whole purpose of using a conditional action - see the FAQ I linked to - is to do one thing OR another.

Bob
Repitol 04 Mar, 2015
Hi Bob,
I'm lost. I added the Events Switcher plugin and created 2 events On Submit
A - show thanks message
B - Paypal redirect full
when I test the form it displays an empty page on submit
I don't understand how to configure the conditional action in the form - How should I link the 2 "submit" buttons to the appropriate event ? I don't see anything in the FAQ about that.
GreyHead 04 Mar, 2015
Hi Repitol,

If you have two submit buttons then you need to check the names IIRC. If you add a Debugger action you can see exactly what is being submitted and work out the code you need to use.

Bob
Repitol 04 Mar, 2015
I miss a big pack of something...
Validation Errors:
Array ( )

the 2 submit buttons display the same page
Event B doesn't redirect to Paypal payment

What a numbskull I am !!!
Repitol 04 Mar, 2015
Well, I'm close to the solution. :?🙂
I didn't know what to set in the Event Switcher [GH] Code so it was stood empty - that's why nothing happened
then I tried that
<?php
if ( $form->data['Paypal'] == 'Payer par carte bancaire' ){
  return 'event_b';
}?>

now, when I click on the form "Payer par carte bancaire" submit button (called Paypal) I'm redirected to the Paypal payment page
but the form is not registered in the DB and I don't receive an email
could you please tell me how to change the code for that purpose ?
GreyHead 04 Mar, 2015
Hi Repitol,

Make sure that the Email and DB Save actions are *before* the Event Switcher?

Bob
Repitol 04 Mar, 2015
That's the point !!!
it works now. GREAAAAAT !! 😀 😀 😀
and now, I reactivate an old thread because the amount calculated in the last field is not automatically the good one
user has to click in the field to have the good value.
thanks for the help Bob, 3 weeks I'm on that issue.
regards
Repitol 05 Mar, 2015
Geeeez !
It does not work actually !
I didn't see the form does not calculate anymore. The "total_a_payer" field stays empty.
Do you think it is a problem with the Event Switcher ?
in Load JS Event I have this code :
window.addEvent('domready', function() {
$('total_soiree_restaurant1_adultes').addEvent('change', rekenen1);
$('total_restaurant1_enfants').addEvent('change', rekenen1);
$('total_coupe_ski_adultes').addEvent('change', rekenen1);
$('total_coupe_ski_enfants').addEvent('change', rekenen1);
$('total_ski_seul_adultes').addEvent('change', rekenen1);
$('total_ski_seul_enfants').addEvent('change', rekenen1);
$('total_buffet_adultes').addEvent('change', rekenen1);
$('total_buffet_enfants').addEvent('change', rekenen1);
$('total_soiree_restau_adultes').addEvent('change', rekenen1);
$('total_soiree_restau_enfants').addEvent('change', rekenen1);
$('total_ski_libre').addEvent('change', rekenen1);
});
function rekenen1(){
$('total_a_payer').value = parseInt($('total_soiree_restaurant1_adultes').value * 55) +
parseInt($('total_restaurant1_enfants').value * 25) +
parseInt($('$('total_coupe_ski_adultes').value * 65) +
parseInt($('$('total_coupe_ski_enfants').value * 58) +
parseInt($('total_ski_seul_adultes').value * 48) +
parseInt($('total_ski_seul_enfants').value * 41) +
parseInt($('total_buffet_adultes').value * 1) +
parseInt($('total_buffet_enfants').value * 1) +
parseInt($('total_soiree_restau_adultes').value * 60) + 
parseInt($('total_soiree_restau_enfants').value * 25) +
parseInt($('total_ski_libre').value * 22)}


Is there a problem here ?
Repitol 06 Mar, 2015
OUPS !
($('$ in the code... I apologize
This topic is locked and no more replies can be posted.