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

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>

Related

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.

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.

Integrating a custom built form with a subscriber list provider (Aweber)

I have created my own form because every other form out there for WordPress is horrible.
div class="exc-form">
<form action="action_page.php">
<fieldset>
<div id="form_jgrsh">
First name:<br>
<input type="text" name="firstname" placeholder="Please enter first name">
<br>
Last name:<br>
<input type="text" name="lastname" placeholder="Please enter last name">
<br>
Email:<br>
<input type="text" name="email" placeholder="Please enter email">
<div class="chk_bx">
<input type="checkbox" name="concent" value="agree">By entering my information and pressing submit I agree to subscribing to the Stockhouse AND Junior Gold Report (please check box before submiting)
<br>
</div>
<input type="submit" class="submit-btn" value="Submit">
</div>
</fieldset>
</form>
It's super simple and isn't anything special. I'm under the impression PHP will be needed as well.
I use Aweber as my list provider, and I've contacted them for support and they want me to use their horrible, ugly form builder, and won't help me integrate my own form to use their list.
I've never done something like this before, so I'm looking for some guidance on how to send subscriber information to a list. Aweber offer's a list ID and most plugins I've seen require a Aweber authentication before Aweber links up to the list.
https://labs.aweber.com/snippets/lists - this is as closest to the resources I could find from Aweber.
Here is the authentication list: https://labs.aweber.com/snippets/authentication

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.

Resources