I've been asked to implement Paypal "Donate Now" functionality on a web site, similar to Wikipedia's site.
I know how to generate "Buy/Donate Now" buttons with fixed amounts, and with variable amounts,
but I don't see how Wikipedia is able to have the user specify the amount on their site and then have it carry over to Paypal, so that the amount is pre-filled once they get there.
Paypal's own documentation does not seem to support an "amount" field (or I've missed it). I actually called Paypal support and was told that I'd have to use a 3rd-party shopping cart for this functionality, but if the carts support this, isn't it just a form param?
Yes, there's an HTML input parameter for this. Simply called 'amount'.
See https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_html_Appx_websitestandard_htmlvariables
Just include amount in any HTML input/select field and ensure you pass it over to PayPal. For example:
<label for="amount">Enter the amount you wish to donate:</label>
<input type="text" id="amount" name="amount" value"">
Or;
<label for="amount">Select the amount you wish to donate:</label>
<select name="amount" id="amount">
<option value="5.00">$5.00</option>
<option value="25.00">$25.00</option>
<option value="50.00">$50.00</option>
</select>
Wikipedia uses some server-side scripting to create a transaction before it sends you to Paypal. This is the shopping cart functionality, yes, specifically the Express Checkout part.
I believe that this image illustrates the process:
(source: paypal.com)
Don't worry - it looks harder than it is: it's very easy to implement.
Related
I have a simple windows application (C++) that I would like to sell. The user downloads the full application which runs for 2 weeks. At the end of that time, the user must buy an access code ($1 - $5) to continue using the application.
The simplest way I've come up with for doing this is to have the application generate a UUID which is written into the registry. The application generates the access code based off the UUID. I would like to pass the access code to Paypal when the user initiates a purchase. If the purchase is successful, I would like Paypal to give the access code to the user (e.g. in an email confirming the purchase). Finally, the user will type the access code into the application to unlock it.
1) If someone has an easier way to do this, please send me an example. My requirements are only that the process require some detailed knowledge to hack (e.g. knowledge of a packet sniffer for my scheme above). (if my application becomes popular enough that someone wants to devote the time to hack it, I will be ecstatic).
2) What I have tried to implement the scheme above:
I have use the directions here to generate a paypal button for a purchase. I can click on the button and make a purchase using the sandbox. What I have been unable to do is a) add new hidden data to this button, and b) find a way for paypal to present that data back to the user on a completed transaction. (There is probably a way for me to do this by having a site that does the paypal ipn stuff found here)
The paypal ipn stuff just seems awfully complicated for something that I would think a lot of applications want to do. What I am hoping is that someone can point out a simpler way to do this with example code.
This is my first time using paypal as a merchant (in case that wasn't obvious).
Here is the sandbox-based button that I have from paypal.
<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post" target="_top">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="SOMETHING">
<input type="hidden" name="machine_id" value="PASSCODE">
<input type="image" src="https://www.sandbox.paypal.com/en_US/i/btn/btn_buynowCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
<img alt="" border="0" src="https://www.sandbox.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>
In this example, I was trying to send my passcode in the machine_id field. I can't figure out how to get paypal to send this back to my buyer.
Thanks.
Chris
You cannot use your own variables.
Try this <input type="hidden" name="custom" value="PASSCODE">
custom - Pass-through variable for your own tracking purposes, which buyers do not see.
Or see list of all variables
https://developer.paypal.com/docs/classic/paypal-payments-standard/integration-guide/Appx_websitestandard_htmlvariables/#id08A6HF00TZS
I'm using a 3rd party shopping cart and i notice that there is no variable for the item description. Any ideas on what variable on how to show or add the item description on the paypal checkout? I already checked the variables to be used on Passing Individual Items to PayPal. Is there anyway to show the item description using a 3rd party shopping cart? Thanks.
With PayPal Standard Payments (the HTML form button code), there's no tag/variable specific for "description", instead, you would be able to customize your item (besides item_name) with the following tags:
<input type="hidden" name="on0" value="Label">
<input type="hidden" name="os0" value="Selection Value">
The tags set will be displayed on the line item area as Options: Label: Selection Value as below
If you need the exact "Item Description" field, you would need to integrate with Express Checkout API and work with parameter L_PAYMENTREQUEST_n_DESCm, see further details on the API reference
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?
I am using Paypal's Adaptive Payments (Preapproval API) for one of my projects.
Everything is working fine, the payments are processed exactly as I want. My only problem is that I can't use the page_style variable as i could with a classic PayPal refirection solution.
When I obtain the pay key for PayPal, I prepare a form like this:
<form method="post" id="gateway_form" name="gateway_form" action="https://www.paypal.com/webscr?cmd=_ap-preapproval&preapprovalkey=PA-XXXXXXXXX">
<input type="hidden" name="page_style" value="mystyle">
<button type="button" class="continue-with-payment" onclick="checkDonateForm(327, 'gateway_form');">
<span>Proceed to Payment</span>
</button>
</form>
Where mystyle is a custom page I have created on my Paypal account which is the application owner.
I have also tried to send page_style as a GET variable e.g. https://www.paypal.com/webscr?cmd=_ap-preapproval&preapprovalkey=PA-XXXXXXXXX&page_style=mystyle but nothing happened.
Any suggestions ?
The page_style variable is for Payments Standard transactions - not Adaptive Payments. I checked to see if there was an equivalent for Adaptive Payments but there doesn't seem to be.
I'll submit a Feature Request asking to include one but I cannot guarantee that it will be implemented - sorry.
I know you can do this with the API, but not sure about the regular signup form.
Does anyone know if it is possible to add some code to the advanced signup form in MailChimp that would automatically add them to a specific group within my list?
I am only collecting the email address and I don't want the subscriber to have to select the group manually. If they are using that form, I want them added to that group.
I have asked MailChimp for help, but they tell me that their customer support doesn't code and that I should hire an expert.
Perhaps a segment of the relevant code may help:
<form action="http://lalala.us2.list-manage1.com/subscribe/post" method="post">
<input type="hidden" name="u" value="345fc4974810ef65c8276c8">
<input type="hidden" name="id" value="25c4d1b28">
<table cellpadding="5" cellspacing="0" border="0" align="center">
<tr>
<td align="right" class="formLabel"><strong>Email Address</strong> <span class="asterisk">*</span>:</td>
<td align="left">
<input type="email" autocapitalize="off" autocorrect="off" name="MERGE0" id="MERGE0" size="25" value="*|MERGE0|*">
<br><span class="error">*|HTML:EMAILERROR|*</span></td>
</tr>
Is there a hidden input type that I can add with a list grouping name that will auto add them to a group?
This is an old question, but I came across it looking for the answer myself and couldn't find a good answer anywhere (including the other answer here which is poor at best). When I couldn't find anything on this I was able to figure it out with a little experimentation.
It requires a couple steps. First, add your Group and the options you want the Group to contain (it can only be 1 if you want). Initially make sure the Group is not set to hidden. Go to your main default sign-up form in MailChimp under Sign Up Forms > General Forms. Verify the Group option(s) are visible and then use the Sign up form URL to visit your hosted sign-up form. Now, open the raw HTML in your browser using right-click > View Source. You need to find the INPUT element for the group / option you want. It will probably look something like this:
<input type="checkbox" data-dojo-type="dijit/form/CheckBox" id="group_8" name="group[13257][8]" value="1" class="av-checkbox">
The name parameter is the critical thing here. Copy and paste that entire input element inside your custom form. Now, use inline CSS to hide it and HTML to hard-code it to checked. You can also remove extra stuff too. The final version in your custom form should look something like this:
<input type="checkbox" id="group_8" name="group[13257][8]" value="1" checked="checked" style="display:none">
This will ensure that it is not visible to the user but it will automatically add them to the group defined by the name parameter that you grabbed from the form which showed it.
The final step is to go back and make sure you set that Group to Hidden to make sure it doesn't inadvertently show up on other forms.
Pretty simple!
All I did was delete the other checkboxes (as well as the unordered list and list item tags around them) and change the checkbox representing the default group I wanted into a hidden field. Literally just type="hidden" instead of type="checkbox" and that did the trick.
You should be able to add a hidden input field with the name of the MERGE TAG set for the specific group.
However, for this functionality it would be much easier to utilize the MailChimp API (even though your question suggests you'd rather not).