PayPal IPN not calling notify_url - wordpress

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.

Related

Send amp-form data to mailchimp with Nextjs

I have a a standard amp form, with an email input, and a sumbit input, and a mailchimp endpoint.
<form
method="post"
action-xhr={`https://${DATACENTER}.api.mailchimp.com/3.0/lists/${LIST_ID}/members`}
target="_top"
>
<fieldset>
<input
type="email"
name="email"
placeholder="Enter your email"
required
className="email-input"
/>
<input
type="submit"
value="Sign Up"
className="sign-input"
/>
</fieldset>
</form>
now the problem is, i need to configure headers,to provide an Authorization API key, and to setup cors.
AMP requires to use xhr to send data. and i have no idea on how to do that inside nextjs, or a serverless function for that matter.
Maybe try this solution - https://www.miguoliang.com/how-to-build-a-mailchimp-embed-form-in-amp-pages.html
You'll have to make an API using mailchimp's python library and provide the credentials and use that API to post data from the form.

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.

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

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>

Paypal Form Payment correct workflow

I need to integrate payments with PayPal and I'm using the form integration
<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_cart">
<input type="hidden" name="upload" value="1">
...
<input type="hidden" name="return" value="http://example.com/Thankyou.html">
<input type="hidden" name="notify_url" value="http://example.com/IPN">
<input type="image" name="submit" border="0" src="/img/logos_icons/paypal-btn.png" alt="PayPal - The safer, easier way to pay online">
</form>
After this point I'm a little bit confused: when the user click on the buy button is redirected on the PayPal website and when the transaction is completed is redirected on the "retun" link (a thank you page). At the same time PayPal send a notification (IPN) to the "notify_url".
is this the correct workflow?
if yes, in the notify method I should book the purchased products but how can I understand which is the original transaction linked to the current notification ?
You have the flow correct, although depending upon the nature of the transaction or user experience you are trying to provide you may have the fulfillment activity "book the purchased products") possible in two places: handled by the page the user the returns to (if they do return promptly and you want to fulfill the order immediately, e.g. so that they can navigate to a subscribed page) and via IPN to catch the cases where the user pays but does not return immediately to your site.
Generally you send a unique identifier of your choice to PayPal in the invoice field of the button; that identifier is linked to whatever context you need (purchase details/shopping cart, user account, whatever) on your side.

Resources