Paypal Button - Adding Variable to return URL - paypal

I am trying to add a simple PayPal button to a website. What I am wanted to do is set up the button to include "options" that need to be selected. This is not a problem, I have the button created and the option select box shows.
What I want to do is return to a URL on my own domain, but have the URL include the selected option from the drop down box that was selected before payment.
so I start at mydomain.com , select an option and after finishing payment have it redirect back to mydomain.com/complete.php?option=theoption
is this possible?

in php you can add this hidden input in your button
<INPUT TYPE="hidden" NAME="return" value="<?php echo 'mydomain.com/complete.php?option='.$theoption ?>">
where $theoption is the value of theoption that you want to be appended on the return url.
Take note that you have to disable payment review so that paypal will automatically redirect back to you website

Related

ASP.NET receive a query string from paypal after payment

I have created a button that allows for users to pay via PayPal and it works,
however when I get back to my page I receive no url query string to catch.
Here is the current code:
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
<button class="ato4" name="submit" type="image" onmouseover="this.style.backgroundColor='#CCC9BD';return true;" onmouseout="this.style.backgroundColor='rgba(79,129,189,0.5)';return true;" style="cursor:pointer;float:right;margin-right:490px;">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="V84TB5GYULLYC">
<font class="shadowfilter">תשלום דרך האינטרנט
<br>
<font style="color:green;">PAYPAL</font>
</font>
</button>
</form>
How do I make paypal automatically redirect to my website without pressing the return button that PayPal has on their website?
apparently there is an option for all pages to auto return to -> url . well it's not as good as an individual pages but it gives the result
You have to enable auto return in your PayPal account, otherwise it will ignore the return field.
From the documentation (updated to reflect new layout):
Auto Return is turned off by default.
To turn on Auto Return:
Log in to your PayPal account at https://www.paypal.com.
The My Account Overview page appears.
Click the Profile subtab.
The Profile Summary page appears.
Click the My Selling Tools link in the left column.
Under the Selling Online section, click the Update link in the row for Website Preferences.
The Website Payment Preferences page appears
Under Auto Return for Website Payments, click the On radio button to enable Auto
Return.
In the Return URL field, enter the URL to which you want your payers redirected after
they complete their payments.
NOTE: PayPal checks the Return URL that you enter. If the URL is not properly formatted
or cannot be validated, PayPal will not activate Auto Return.
Scroll to the bottom of the page, and click the Save button.
IPN is for instant payment notification. It will give you more reliable/useful information than what you'll get from auto-return.
Documentation for IPN is here: https://www.x.com/sites/default/files/ipnguide.pdf
Online Documentation for IPN: https://developer.paypal.com/docs/classic/ipn/gs_IPN/
The general procedure is that you pass a notify_url parameter with the request, and set up a page which handles and validates IPN notifications, and PayPal will send requests to that page to notify you when payments/refunds/etc. go through. That IPN handler page would then be the correct place to update the database to mark orders as having been paid.
Ref.: Setting PayPal return URL and making it auto return?

Paypal checkout opens on a separate tab - how to change this?

I have found that the Paypal generated buttons is a very good solution for my wife's website. However, whenever someone presses on the "add to cart" button, he/she is taken to a separate Internet Explorer tab. That's fine. However, if they chose to "continue shopping", IE tries to close the Paypal tab and asks the user's permission to do so. This is not really ideal from the user experience point of view.
Can I force the Paypal Checkout to open in the same IE tab as the main website?
Thank you.
The PayPal Standard shopping cart will always function that way. I highly recommend you go with your own shopping cart instead. That way there are no new windows/tabs at all, and the redirection doesn't happen until the person is ready to pay.
There are lots of options for doing this. You could build a cart into your site as a custom solution, or what would be even better would be to go with something like WordPress and WooCommerce.
To avoid redirecting to a different tab, you can use minicart PayPal plugin.
You just need to include the following lines of code inside your
<script>
paypal.minicart.render();
</script>
MiniJS Demo
I had this issue as well, in your check out button you should have target="_self" like this:
<form id="paypal-checkout-button" target="_self" action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post">
Don't mess around guys!
Just remove target="paypal" attribute from the paypal form.
<form target="paypal" action="https://www.paypal.com/cgi-bin/webscr" >
change to
<form action="https://www.paypal.com/cgi-bin/webscr" >
This will now open paypal in the same tab/page of the browser.

Submit button action

<FORM ID='htmlform' action="" onsubmit="return valforms(this)">
.....
<INPUT TYPE="submit" NAME="submit" VALUE="Submit">
When the user is done filling out the form, and clicks the submit button, I want all of the form information to be sent to me. How do I do this? This is only part of the code, the whole code is too long for me to type in here.
To reply on your question:
Oh, so like the page that emails the data is that an html page that I can have a message saying, "Thank you for your interest, you will hear back from us soon." and then have the page redirect to the home page again? I hope I'm not getting too complicated with this
You're almost right. Let me explain it to you:
the user gets a HTML page that was made in PHP, ASP,.. to fill in
some data in a form
the user fills in the data and clicks a button
The action on the button tells the server to process the page, or have another page to process it. Let's call this page PageX
PageX (written in PHP, ASP,...) will email the data to you
You can also have pageX return some text to the user's browser saying "thank you for your interest,....". You can also make a redirect to another page from this page
Does this answer your question?
The action part of the form element tells the browser what URL to post the information to. You would need to specify some page with some server-side code that would take that information and store it or send it in an email. The onsubmit part of your form element fires a JavaScript event that can be handled on the client's machine. You cannot do much on the client's machine without sending the data back to the server.

How to skip paypal thank you page?

In paypal, is it possible to skip the "Thanks for your order page" and come directly back to our store? Here i have attached the screenshot of the page which is coming after "Pay Now" page and this is the page i want to skip and i need to directly go to my website from where the process is initiated.
Check these settings at your paypal account --
click at edit profile tab in your paypal acc.
click “website payment preferences” under “selling
preferences”
click “on” for auto-return.
enter a return URL.
Save.
Let me know if u face any prob while configuring.
NEW EDIT
You can also pass like this --
<INPUT TYPE="hidden" NAME="return" value="URLspecificToThisTransaction">

Stop resubmit on form

I have a simple form on my site that allows users to add comments on photos. However, the form doenst use ajax (like facebook). Instead, it submits the form and refreshes the page. This is fine however, if a user reloads the page, there is an alert that he/she will resubmit the data resulting in two of the same comments. Id like to remove this resubmit without sending the user to a confirmation page. Thanks.
Here is my form:
<form name='form' action='index.php' method='POST'>
<input type='text' name='comment'>
<input type='submit' value='submit' name='submit'>
PHP:
if (isset($_POST['submit'])){
$comment=$_POST[comment];
$time=time();
$id=$_GET['id'];
$put=mysql_query("INSERT INTO comments VALUES ('','$user','$time','$comment','$id')");
Is your PHP script simply re-rendering the page in response to a form post? The standard way to get the behavior you describe is that it should either return a HTTP status of 204 (No content) or 303 (see other, with a redirect to the page you want to show).