Page 1 of 1

Adding extra payment options in Paypal button

Posted: Fri May 31, 2019 1:20 pm
by iMatt
Say I am creating two sizes of the same basic item. The standard size is £2 and the larger size is £3.50. Whilst this can be created easily enough using a form combobox, is there any way this can be reflected in Paypal? Because only one price seems to be allowed.

Re: Adding extra payment options in Paypal button

Posted: Fri May 31, 2019 1:42 pm
by Pablo
There is an example for this in the Form Wizard.

Re: Adding extra payment options in Paypal button

Posted: Fri May 31, 2019 1:49 pm
by iMatt
Okay. Can the form wizard be used with PayPal?

Re: Adding extra payment options in Paypal button

Posted: Fri May 31, 2019 1:53 pm
by Pablo
The Form Wizard creates a standard form whihc is setup for PayPal, because PayPal buttons only support one price.

Re: Adding extra payment options in Paypal button

Posted: Fri May 31, 2019 3:36 pm
by BaconFries
Once you have you have installed the example you will notice that the combobox has two prices. On select of either and on submit/pay then that selection will be used and sent to PayPal for payment.

Re: Adding extra payment options in Paypal button

Posted: Fri May 31, 2019 3:59 pm
by iMatt
okay, I have created a form using the form wizard. How do i get the 'add to cart' button to send info/submit to PayPal?

Re: Adding extra payment options in Paypal button

Posted: Fri May 31, 2019 4:18 pm
by Pablo
The form wizard creates the complete form so there is no need for a separate PayPal button in that case.
The PayPal options can be configured via the 'hidden fields' of the form.

Re: Adding extra payment options in Paypal button

Posted: Wed Jul 24, 2019 10:25 pm
by alex4orly
I have created a membership / donations page for this organisation here :
https://communitylifestyleaccommodation ... modal.html
Click the accept to view the page

I tried engaging with a Payment Gateway service provider, but it is hard to deal with them.
I am considering switching to using PayPal instead.

So, the PAGE activates various payment options, but the one selected last is the one the visitor to the page wants to pay.
So, can I replace that "Pay Now" button with a PayPal button, or must I start again and create a form with the wizard?

Thanks

Re: Adding extra payment options in Paypal button

Posted: Thu Jul 25, 2019 6:03 am
by Pablo
You can modify the existing form, but for PayPal you will need to add the required hidden fields.
What you can do, is create a new form on another page and copy all the values manually.

Re: Adding extra payment options in Paypal button

Posted: Thu Jul 25, 2019 9:49 am
by alex4orly
I created the button, it generated the following code, it takes me to the paypal page - but the amount 200 doesn't show up
Why?
Here is the code generated by the button:

<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" id="PayPal1_form" method="post" target="PayPal">
<input type="hidden" name="business" value="alex4orly@gmail.com">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="item_name" value="Big Dog">
<input type="hidden" name="item_number" value="BG22">
<input type="hidden" name="amount" value="220">
<input type="hidden" name="currency_code" value="AUD">
<input type="hidden" name="shipping" value="">
<input type="hidden" name="shipping2" value="">
<input type="hidden" name="handling" value="">
<input type="hidden" name="return" value="www.cla-ltd.org">
<input type="hidden" name="cancel_return" value="www.cla-ltd.org/fault.html">
<input type="hidden" name="undefined_quantity" value="0">
<input type="hidden" name="receiver_email" value="alex4orly@gmail.com">
<input type="hidden" name="no_shipping" value="2">
<input type="hidden" name="no_note" value="1">
<input id="PayPal1" type="image" name="submit" src="mypictures/paynow.jpg" alt="Make payments with PayPal, it's fast, free, and secure!">
</form>

Re: Adding extra payment options in Paypal button

Posted: Thu Jul 25, 2019 12:38 pm
by Pablo
The standard PayPal button does not show the amount. Only during checkout.

Re: Adding extra payment options in Paypal button

Posted: Thu Jul 25, 2019 8:37 pm
by alex4orly
I found the answer, if the script is in sandbox mode, it doesn't, but in Live it does - yes, at tha checkout stage
I just need to figure out how to set the "amount" element value dinamically (depending on the user choice) with Javascript function

Thanks

Re: Adding extra payment options in Paypal button

Posted: Thu Jul 25, 2019 10:43 pm
by alex4orly
I tried :

document.getElementByName("amount").innerHTML = topay;
But it doesn't work, it seems that "name" has been depracated

I would like to use:
document.getElementById("amount").innerHTML = topay;
But, the code generated by WWB doesn't show an ID for that field
<input type="hidden" name="amount" value="">

So?

Cheers

Re: Adding extra payment options in Paypal button

Posted: Thu Jul 25, 2019 11:14 pm
by BaconFries
But it doesn't work, it seems that "name" has been depracated
Alex, are you saying that "name" is depracated in PayPal forms?
But, the code generated by WWB doesn't show an ID for that field
<input type="hidden" name="amount" value="">
It isnt that WWB doesn't generate an "ID" PayPal hidden fields don't use it.

Re: Adding extra payment options in Paypal button

Posted: Thu Jul 25, 2019 11:23 pm
by alex4orly
But I need the idea to be able to assign a value to in real time, depending on what the visitor wants to pay.
According to the w3 school, name is deprecated...
I need the I'd.
How?
Cheers

Re: Adding extra payment options in Paypal button

Posted: Fri Jul 26, 2019 12:02 am
by BaconFries
You have misread it, it is obsolete in HTML5 not deprecated. It is suggested to use "ID" in HTML5. On forms you should still use name="" to label your form controls. If you need to use "id" you will need to manually add yourself and use getElementById() rather than getElementByName()

Some useful reading regarding attributes:
https://developer.mozilla.org/en-US/doc ... Attributes

Re: Adding extra payment options in Paypal button

Posted: Fri Jul 26, 2019 12:17 am
by alex4orly
I tried GetElementByName() - it didn't work
My alternative is to create a Pay Now button for each option - then I can hard code the amount
Please have a look here : https://communitylifestyleaccommodation ... modal.html
Click "Accept" to get to the page

Re: Adding extra payment options in Paypal button

Posted: Fri Jul 26, 2019 3:59 am
by alex4orly
Is there a way for me to trap the Onclick PayPal button?
If there is, I could insert a call to a Javascrip function to assign the relevant price to the "amount" variable

Cheers

Re: Adding extra payment options in Paypal button

Posted: Fri Jul 26, 2019 5:21 am
by GrahamW
Hi Alex

have a look at my mals ecommerce extension for WWB it uses paypal as the payment gateway but there is quite a few options or styles you can set your page up with
Demo here:
https://www.shop.grahamscomputers.net/d ... sdemo.html
Purchase here:
https://shop.grahamscomputers.net/websh ... ite-1.html

Need any more info please just ask
Graham

Re: Adding extra payment options in Paypal button

Posted: Fri Jul 26, 2019 5:54 am
by alex4orly
Hello Graham

Please have a look at the site I am working on here : https://communitylifestyleaccommodation ... modal.html
It DOES NOT need an actual shopping cart, just a link to Paypal Standard Payment page

Thanks
Alex

Re: Adding extra payment options in Paypal button

Posted: Fri Jul 26, 2019 12:22 pm
by alex4orly
I am trying to trap the pay button, here is the form code first:
<form action="https://www.paypal.com/cgi-bin/webscr" id="PayPal1_form" method="post" target="_self">
<input type="hidden" name="business" value="alex4orly@gmail.com">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="item_name" value="Big Dog">
<input type="hidden" name="item_number" value="BG22">
<input type="hidden" name="amount" value="">
<input type="hidden" name="currency_code" value="AUD">
<input type="hidden" name="shipping" value="">
<input type="hidden" name="shipping2" value="">
<input type="hidden" name="handling" value="">
<input type="hidden" name="return" value="www.anz.com">
<input type="hidden" name="cancel_return" value="anz.cba.com">
<input type="hidden" name="undefined_quantity" value="0">
<input type="hidden" name="receiver_email" value="alex4orly@gmail.com">
<input type="hidden" name="no_shipping" value="2">
<input type="hidden" name="no_note" value="1">
<input id="PayPal1" type="image" name="submit" src="mypictures/paynow.jpg" alt="Make payments with PayPal, it's fast, free, and secure!">
</form>

And now, inside the Body section I have the following:
<script>
document.getElementById("PayPal1").addEventListener("click", function(){
alert("Hello World");
});
</script>

But, the alert() doesn't show up.
I am trying to use this event to assign the value of the payment to the form "amount" variable....
Any other idea?
Whay this is not working?

Thanks