Paypal Donation Button in asp.net page - asp.net

I've created a paypal donation button from paypal business account with all default setting. I copy paste the html into my asp.net page, and it looks fine. The problem is when I click on the button simply nothing happen. Is this because I'm still on localhost? Will it be work and go to paypal page when I upload the website?
<form action="https://www.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="buttonId">
<input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
<img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>

Your asp.net page probably already has a form tag on it and you may have placed the PayPal code inside that form, which won't work. Instead of using the form with the hidden fields that PayPal generated for you, you could just use a link with url parameters. Here's an example (make sure you replace YOUR_BUTTON_ID_HERE with your id):
<a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=YOUR_BUTTON_ID_HERE">
<img src="https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif" border="0" alt="PayPal - The safer, easier way to pay online!" />
</a>

Good afternoon. In your original example, no hosted button ID was provided:
<input type="hidden" name="hosted_button_id" value="buttonId">
PayPal buttons are hosted on your PayPal account, so in order for the checkout to appear, an ID must be present.
In order to locate the hosted button ID, log in to your PayPal account and go to Tools > PayPal Buttons. Click on the carat next to the button you are trying to add, and the button ID will display. Just substitute that value for "buttonId", and it should be working.

Related

How to pass custom amount with Bitpay hosted checkout form?

I am looking to integrate BitPay for processing bitcoin payments on one of my sites.
Their hosted checkout form (similar to PayPal checkout form) is easy to integrate however I don't know how I can pass order amount with the form so that the same checkout button can be used for different orders (payments).
Here's their page regarding hosted checkout: https://bitpay.com/help-hosted-checkout
Bitpay has clearly stated that we can pass different order amount but they have not provided any field for this on the above mentioned page. I have contacted them and they will reply in 3 days but since I need to integrate this at the earliest, I hope somebody here can help me fast.
Thanks.
I was also looking for help with a bitpay button for a project and found this question (and another one like it), so coming back to answer in case it can help others in the future: If you got your bitpay button code from the payment button option on bitpay, your code might look something like this:
<form action="https://test.bitpay.com/checkout" method="post">
<input type="hidden" name="action" value="checkout" />
<input type="hidden" name="posData" value="" />
<input type="hidden" name="price" value="<?php echo $price_var;?>" />
<input type="hidden" name="data" value="...(your data value)..." />
<input name="checkout" type="submit" value="Checkout" class="form-button-submit button"/>
</form>
Having the line of code with 'name="price"' allows you to set a global variable (potentially your shopping cart total) as an order amount. Hope this helps!

POST request to Paypal ignoring parameters

Good afternoon,
I'm attempting to send a POST request from my ASP.NET web app to the paypal API to process a payment. The code below is the standard generated button code from the developer site with a few more parameters added by me.
<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="business" value="testseller#mydomain.co.uk" />
<input type="hidden" name="hosted_button_id" value="myvalue"/>
<input type="hidden" name="item_name" value="<%:Article%>"/>
<input type="hidden" name="amount" value="<%Price%>"/>
<input type="hidden" name="currency_code" value="GBP"/>
<input type="image" src="https://www.sandbox.paypal.com/en_US/i/btn/btn_buynow_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>
However when the paypal payment screen loads, it has reverted the cost to 0.01 US dollars and seemed to ignore my parameters. On inspection, the <%:Price%> variable is reading as I would expect. Is there anything glaring I'm doing wrong in the above HTML?
If you are using Hosted Button which is saved on PayPal side, you cannot edit the button code. PayPal will ignore any additional variable added / update to the button code. If you want to pass dynamic variables to PayPal end, then you should use non hosted button.

Integrate Contact Form 7 with external mailing list (Wordpress)

I need to integrate Contact Form 7 with a newsletter subscribe form so that when a "subscribe" checkbox is ticked, the contact form is sent and the contact details are sent to the newsletter list (similar to how the MailChimp plugin works). The newsletter app provides the following basic HTML signup form:
<form name="signup" id="signup" action="http://mailing-list.com/signup.ashx" method="post">
<p></p>
<input type="hidden" name="addressbookid" value="XXX">
<input type="hidden" name="userid" value="XXX">
<input type="hidden" name="ReturnURL" value="">
<table>
<tr>
<td>
Email</td><td><input type="text" name="Email"></td></tr>
<tr><td>FIRSTNAME</td><td><input class="text" type="text" name="cd_FIRSTNAME"/></td></tr>
<tr><td>LASTNAME</td><td><input class="text" type="text" name="cd_LASTNAME"/></td></tr>
</table>
<input type="Submit" name="Submit" value="Subscribe">
</form>
How do I integrate this with Contact Form 7?
I eventually got it to work using a plugin to map the contact form fields to the external mailing list: http://wordpress.org/plugins/forms-3rdparty-integration
I was able to connect my Contact Form 7 to Mailchimp using MailOptin plugin as the bridge. And it's free in the WordPress plugin repo https://wordpress.org/plugins/mailoptin/
And it also support dozens of email marketing software and CRM and also support checking a checkbox before users are added to your integration.
Here’s the article on how to do it https://mailoptin.io/article/contact-form-7-mailchimp-aweber-more/
Hope that helps.

PayPal donate button inside a form not working

Consider the code below -
<form id="Form1" runat=server defaultbutton="cmdclick" style="height: 9%;">
<form action="https://www.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="XT4SGK2B4H954">
<input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_donate_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
<img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>
</form>
The inner form is not getting submitted. It refreshes the page on clicking on it.
What would be the better method?
Note : Project is in ASP.NET.
An ASPX page is like a giant HTML form and when you throw in another form without closing the ASP one you end up with nested forms.
To resolve the problem you need to close the ASP form before the PayPal button code starts or create a PayPal button as a URL and hyperlink it to some text or an image on your site.
The problem is that HTML does not allow nested form tags.
Please see my response to a similar question here. I describe an alternative approach to include PayPal buttons in ASP.Net pages.
Hope it helps.
I solve it by adding the paypal code in html page and view it in my asp.net page via iframe.

Why is wordpress now removing form tags from the HTML editor on publish?

I'm trying to insert a paypal button using their code into the HTML tab of the wordpress wysiwyg editor. When I publish and view the source code in chrome, the form tags don't show and the button action does not happen when clicked.
The form tags do remain there in wordpress, however.
Any knowledge of why these wouldn't be carrying over? I've never had this happen, and it was working last week, same code, same project.
Could it be the newest wordpress upgrade?
It's weird because another button on another page of the same site, from paypal as well, works still..
Code from paypal:
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="QLFJU8MHD2XCN">
<input type="image" src="http://www.spmoh.com/wp-content/uploads/2012/06/donate-now.png" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
<img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>
The form elements are still there in the source code. I can think of two possible reasons why they are removed in the DOM view:
Invalid nesting of elements, for example h1 elements (that are block level elements) inside a ones. At a quick glance, I can't see anything on that page that could be causing it, though
JavaScript removing the elements afterwards (e.g. some rogue jQuery cleanup script).

Resources