POST request to Paypal ignoring parameters - asp.net

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.

Related

Wordpress search form by category not working?

Objective
I am trying to create different search forms for two different landing pages. Thus, users who end up on landing page A will only be able to search for products with categories Man and Book. Users landing on page B will only be able to search for products with categories Beast and Funny.
Here is my example setup in WooCommerce.
What I have tried
Based on this link, I have tried the following search function for page A.
<form role="search" method="get" id="searchform" action="https://test.com/">
<div>
<label for="s">Search for (Man and Book):</label>
<input type="text" value="" name="s" id="s" />
<input type="hidden" value="1" name="sentence" />
<input type="hidden" value="product" name="post_type" />
<input type="hidden" value="product_cat" name="man,book" />
<input type="submit" id="searchsubmit" value="Search" />
</div>
</form>
Problem
If I key in GetAllX into the search form, I expect to see GetAllX (Copy 2) only. Instead, I see GetAllX (Copy 2) and GetAllX.
Also, when I key in test, I expect to see Test product 2 only. Instead, I see both Test product 2 and Test Product.
Questions
Why is WordPress behaving like this? Can someone help me out with this, please?
If there is an easier way to create search forms for different product categories based on landing pages, please do let me know.
Found the error. It was in this line:
<input type="hidden" value="product_cat" name="man,book" />
It should be instead:
<input type="hidden" value="man,book" name="product_cat" />
There was a typo in the article I linked to.

PayPal IPN not calling notify_url

So I have this form in my Wordpress site and I've configured it to use the PayPal sandbox:
<form action="https://sandbox.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="business" value="daniel-facilitator#domain.com">
<input type="hidden" name="item_name" value="Test - 11/11/2017">
<input type="hidden" name="item_number" value="13877">
<input type="hidden" name="notify_url" value="http://b1248fa5.ngrok.io/wp-admin/admin-ajax.php?action=eab_paypal_ipn&blog_id=1&booking_id=1">
<input type="hidden" name="amount" value="5">
<input type="hidden" name="return" value="http://b1248fa5.ngrok.io/events/2017/11/test/">
<input type="hidden" name="currency_code" value="EUR">
<input type="hidden" name="no_shipping" value="1">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="quantity" value="1" max="1">
<p>Haz click aquĆ­ para pagar tu entrada</p><input type="image" name="submit" border="0" src="https://www.paypal.com/en_US/i/btn/btn_paynow_SM.gif" alt="PayPal - The safer, easier way to pay online">
<img alt="" border="0" width="1" height="1" src="https://www.paypal.com/en_US/i/scr/pixel.gif">
</form>
It is generated by the Event + plugin. I has been working fine all year round until now.
This is what is happening:
I submit the form.
I get to my sandbox account's login page. I login.
My sandbox account's dashboard opens up.
Nothing happens... I'm waiting for PayPal to call my notify_url handler, but it doesn't!
If I use the PayPal IPN simulator with the same notify_url, then it is a whole other story. I get a message saying:
IPN was not sent, and the handshake was not verified. Please review your information.
However, in this case, my notify_url does get called.
What could be going on here? Why PayPal is not calling my notify_url when I submit my form?
The IPN will not be triggered until a transaction is completed. It sounds like you're not fully completing the transaction before expecting to see it hit..??
If you are completing the transaction and you aren't getting what you expect then you need to check the IPN History in the PayPal account to see if it's showing that IPNs are being sent and what the response is on them. Based on what you see there you'll go one direction or another.
If it looks like it's sending things fine, then you'll need to check the web server logs to see what's happening when your IPN URL gets hit. There must be an error happening.
For more details take a look at my article on how to test PayPal IPN.

Paypal Donation Button in asp.net page

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.

How to use a sandbox buyer account with PayPal payment button?

I am trying to use a PayPal button in a simple html page in my dev environment.
For this,
I created a business account on PayPal using my personal email account
Then, I generated a Subscibe button using this business account
After above steps I went to https://developer.paypal.com/developer/accounts/ where I found a test buyer and a test business account automatically created.
When I run the page whose markup is as below, it takes me to a payment page that looks like this:
Question: When I click on login button in above screen shot and try to login using the test buyer account that's there in my sandbox accounts, it never logs in? Is the sandbox account supposed to be used differently or am I missing some steps?
My Html Page Markup using PayPal button
<!DOCTYPE html>
<html>
<head>
<title></title>
<meta charset="utf-8" />
</head>
<body>
<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="LZPMU8S36JYEL">
<table>
<tr><td><input type="hidden" name="on0" value="Plan Options">Plan Options</td></tr>
<tr>
<td>
<select name="os0">
<option value="Basic">Basic : $100.00 USD - monthly</option>
<option value="Silver">Silver : $150.00 USD - monthly</option>
<option value="Gold">Gold : $200.00 USD - monthly</option>
</select>
</td>
</tr>
</table>
<input type="hidden" name="currency_code" value="USD">
<input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_subscribeCC_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>
</body>
</html>
I found the answer to my problem.
The reason the test buyer account was not working was because I created the PayPal button html using a PayPal account that was valid only in live environment. When you sign up as a new user on Paypal you always end up creating an account in live environment of PayPal.
The button html was generated using this live environment account and therefore it was not working with the test buyer account.
I needed to create the button html using the test business account that was automatically created in sandbox i.e. in test environment for my live PayPal account. To do that I have to go through the 3 steps mentioned below.
go to https://developer.paypal.com/developer/accounts/ and change the account type to Business Pro by going to the Profile of test business account
then go to https://www.sandbox.paypal.com/home and login using this test business account ( don't try to login with this account on https://www.paypal.com/webapps/mpp/merchant since it will never log you in when using test accounts)
once you have logged in with the test business account, you should then create the button html.
The button html if properly generated using above 3 steps, should have the action attribute of form element point to a www.sandbox.paypal.com URL and not to a www.paypal.com URL.
The html I got after these 3 steps is as below which I found worked with test buyer account.
<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="AW24K22D6HW9Q">
<table>
<tr><td><input type="hidden" name="on0" value="Plan Options">Plan Options</td></tr>
<tr>
<td>
<select name="os0">
<option value="Basic">Basic : $100.00 USD - monthly</option>
<option value="Silver">Silver : $150.00 USD - monthly</option>
<option value="Gold">Gold : $200.00 USD - monthly</option>
</select>
</td>
</tr>
</table>
<input type="hidden" name="currency_code" value="USD">
<input type="image" src="https://www.sandbox.paypal.com/en_US/i/btn/btn_subscribeCC_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>

how to update kml file in google map api v3?

My KML file had been uploaded into my Google Map account. But how can I update it without upload again. For example, I want to allow user can change one polygon's color in website. Can user use my account to update my KML file and show it dynamic?
Firstly, I try to use Google Maps Data API and log in my account, but it not work.
<form method="post" action="https://www.google.com/accounts/ClientLogin">
<input type="hidden" name="accountType" value="GOOGLE" />
<input type="hidden" name="Email" value="**#gmail.com" />
<input type="hidden" name="Passwd" value="***" />
<input type="hidden" name="service" value="local" />
<input type="hidden" name="source" value="mycompany-myapp-1" />
<input type="submit" name="submit" value="Submit" />
</form>
Then I get auth="DQ**", and use this auth to do next step:
<form method="get" action="http://maps.google.com/maps/feeds/maps/default/full">
<input type="hidden" name="Authorization" value="GoogleLogin" />
<input type="hidden" name="auth" value="DQ***"/>
<input type="submit" name="submit" value="submit" />
Will get error......
In fact, I just want to make a webpage that allow users to make their own shade maps. I have a KML file of combining many polygons. And these polygon have different style. How can users update polygons' style?
Thanks a lot,
Other users can't change your Google Map account data.
One option would be to import that kml into a FusionTable, then use dynamic styling to change its color. If you want them to be able to change the color and save that change, you could write code to change styling information in the FusionTable, but everyone would see the change, not clear if that is what you want or not.

Resources