Customize PayPal Donate button to pass info through to PayPal page - javascript

I have a requirement to capture some info about a donation before the user is redirected to the payPal page, and to pass some of that info through to the page. The three main things is the amount, currency, and whether or not it should be a reoccurring payment. We want to have the user specify that detail before clicking "Donate", and then have that info sent through to PayPal to repopulate the page.
I have managed to achieve some of this by using the "Buy now" button, instead of the "Donate" button, and just displaying the Donate image. With that I can pass through the amount and currency, but can't set reoccurring payment it seems. At least, I don't know what the form input should be called for that option to take effect on the PayPal side. In order to do this, I had to set a couple of options when creating the "Buy now" button. I think the one was to not keep inventory or something like that, and on the page where I can copy the HTML I had to effectively unlock it. But there are no such options on the Donate button creation flow. So when I try to pass amount or currency through to the Donate page, it doesn't do anything.
I tried removing the button_id hidden input, but that just breaks the whole thing.
Is there any way for me to capture those three pieces of information - amount, currency, and whether or not it should be a reoccurring payment - on my site and pass it through to the PayPal screen upon redirect?

If you want to specify that a payment should be recurring, then the checkbox on your site that makes the donation recurring will need to convert the button into a completely different type-- a "Subscriptions" button. That is the only way for you to specify that something is recurring before the buyer reaches PayPal.
The other way of starting with a Donate transaction and having it become recurring, only works for:
transactions of type Donate (not Buy Now)
when the amount is NOT pre-specified before redirecting them
when the user selects this recurring checkbox at PayPal
All three conditions are necessary and required for this type of recurring donation to be possible.

Related

Go to AJAX search query link only after clicking search button

I'm using the JetSearch plugin on this website.
Right now, after choosing a category and typing in the search query and clicking the query, it instantly goes to the page of that query (I think it's better but my client wants it different for a reason).
My client wants a user to enter the search query, select it and press the search button which then takes you to the page/link of that query. It should act the same as on this website.
This goes beyond my knowledge, hence the cry for help.
Cheers,
Nathan

On failed form submission, prevent change to dropdown option (Javascript, Jquery)

I am working towards the tech degree at team treehouse and my 3rd project is to make a form interactive. I'll explain my issue in point form to make it easier.
Credit card payment method needs to be selected on page load
Change this method to Paypal but do not fill out all the required fields and hit submit
Payment option reverts back to credit card but still shows paypal info
if anyone could point me in the right direction as to how to keep the paypal option selected on an unsuccessful form submit that would be awesome.
Here the link to my code: https://github.com/Allan-Glasier/InteractiveForm
I'm not sure what the Paypal info was shown, but you can use this info to initialize the selected option on page load event. For example:
$(function(){
//Get if the displayed info is for Paypal
if($("div#<Paypal info div id>").is(":visible"){
//Set Paypal option selected
....
}
})

Sending users to different sections of survey

So I just created a google forms survey and wondered if its possible to send the users to different sections.
I am looking for at way to direct half of the users directly to section 2 and have the other half only see section 1.
User 1: Sees only section 1
User 2: Sees only section 2
User 3: Sees only section 1
and so on
Is there a way to keep a counter in google scripts that that sends the users directly to a section depending on whenever its odd or even without having them answer any questions first?
On the form you can specify that after each of those sections, the form should be submitted instead of continuing on to the next section.
Then, you can get a pre-filled URL for each of the different users by:
Go to the form editor, and on the first page of the form, add a multiple choice question that has each different user as the options.
Then, check the box that says Go to page based on answer.
Next to the multiple choice options for each user, choose Go to page X, depending on which users should go to which sections.
In the menu, go to Responses > Get pre-filled URL.
For each user, select that user from the first multiple choice question and then click Submit.
In the new URL to share the pre-filled form, change viewform? to formResponse? and add &continue=continue to the end of the URL.
Repeat this for each of the different users and then give the users these new URLs for them to fill out the form.

Disable JS Submit Validation Checks

I don't really know how to explain this one very well so here we go.
I am trying to implement the Stripe payment button on my page. When the submit button is click, the JS validates the users input. That said, I do not have access to the JS file.
I am trying to add the ability for users to choose weather to pay by check (in which the stripe form elements disappear and other appear related to paying by check).The problem is, when the user selects to pay by check and click submit, the validation checks for the stripe form are run, they of corse fail and the submit action is aborted.
So how, when the user selects check, can I disable the Stripe actions?
Thank you in advance for any help.
You should have different forms for the different payment methods, so that the Stripe form doesn't think it is being submitted.
Here's my guess as to how you could disable the listeners, anyway:
$("#payment-form").unbind('submit');
You have a couple different options. One would be to work with the event handlers in javascript when the user chooses to pay by check. Another option (probably simpler) option would be to have 2 submit buttons and show and hide them depending on how the user intends to pay.

Make a form submit() behave like location.replace()

IN SHORT:
There's this web page that needs to be submitted when the user loads the page. There is a good reason for it, long story.
Would it be possible to make a form post submit() behave like a location.replace()? No history trace.
Thanks.
LONG STORY: In my CMS, I have one page for each product. Products are normally listed on section pages, where the user is invited to choose a product :
Small $10 BUY
Medium $20 BUY
Large $30 BUY
Clicking on BUY would send the user to the payment page, off-site.
The product details come from the CMS page, where I defined specific fields for price, product ID, etc. Product detailes are rendered as a form.
I basically don't want to show the independent, permalink product pages, ever. But, this being a CMS, the products will be listed on section pages and whatnot, and the user may end up choosing the products by clicking on a link instead of the full rendered page with the form.
If they do end up on the product page, I want them to be redirected to the purchase page. Of course I don't want to keep the page in history, for the same reasons location.replace() was invented: to avoid the back button of eternal redirection.
Just do an AJAX POST followed by a location.replace. The AJAX POST won't create a browser history entry.

Categories