Django Multiple paypal IPN signals received - django

We are using django-paypal for paypal ipn notification.
All works great signals are received and inserted in the ipn tables .
We have specified the IPN URL in merchant profile. When you check the history logs of paypal ipn it says retrying ... times even though our server is receiving each signal
We even wrote to paypal regarding this but they say they are not getting http status code 200 from our server.
What could be the issue when all signals are successfully inserted into our database.Each purchase has atleast 10 entries which is number of times paypal tries to send if it doesnt get 200 status
Any help to fix this is much appreciated

The issue is fixed.
After saving the object (ipn) it should return HttpResponse("OKAY") to paypal
but somehow my code had an empty return

Related

Paypal Sandbox not sending IPN back to django through ngrok tunnel, but works fine on IPN Simulator

I have a django app that uses django-paypal to manage payments and trigger certain actions using signals.py when the payment is received
#receiver(valid_ipn_received)
def payment_notification(sender, **kwargs):
ipn = sender
if ipn.payment_status == 'Completed':
# payment was successful, do something
In order to test it locally, I'm using ngrok to expose the local server to Paypal services.
Using the IPN Simulator everything is working fine and the signal in the django platform is triggered.
However, when I interact with the sandbox under the same conditions, I am not receiving the IPN back from Payal after the payment is completed. From the sandbox business account dashboard I can see the payment is received, but looking at the IPN History from the same account I notice that Paypal is not able to send the IPN, claiming a "failed operation" without further information (not even an error code from the server).
The strangest thing is that the sandbox flow was working like a charm until two days ago. Now I am only able to test through the IPN Simulator.
What am I doing wrong?
While not exactly a technical solution, I think its worth keeping track of how this problem was solved. Turned out there was a bug on the Paypal side, so as Patryk Szczepański suggested in the comments, what worked here was contacting Paypal technical support. They solved the problem in a matter of hours.

Issue in redirecting back to our Site from sandbox test authorize net

After processing the payment, control is not directing back to our site(x_relay_url) from https://test.authorize.net/gateway/transact.dll.
The URL mentioned in the x_relay_url cannot be accessed directly it requires session id and other details to access it which was passed to Authorize net page using merchantDefinedData variables.
I checked the following article also but our URL seems to be fine and we checked our code there is nothing wrong in that.
I tried multiple URLs in "x_relay_url" but nothing seems to be working.
Any help is appreciated.
Error Message:
An error occurred while trying to report this transaction to the
merchant. An e-mail has been sent to the merchant informing them of
the error. The following is the result of the attempt to charge your
credit card.
This transaction has been approved.
It is advisable for you to contact the merchant to verify that you will receive the product or service.

django paypal ipn - how should I know that a payment process has been started?

I'm trying to implement a checkout system with django-paypal. The system is working, but regarding the work flow I am quiet confused. django-paypal uses a form to post to PayPal, only after the payment has been processed I get a notification via IPN. Unfortunately this does take a lot of time (going from seconds to minutes).
Now it would be nice to log a pending state in my database so that I could tell the user to wait until the IPN has been received... but as django-paypal posts directly to PayPal and gives no feedback to my server I am stuck as there is no information being sent to the server. I could implement a switch to "pending" when opening the return url, but a GET shouldn't modify the state if the database...
Solution to me was to also add the PayPal PDT. They are not exclusive. Both IPN and PDT can be called from the same form.

Customizing WooCommerce e-mail templates

I have used WooCommerce before, but have never done much customization to it until recently.
I customized the e-mail templates to show the payment information, like transaction number, etc.
This works fine except for one thing.
Right now if a person pays with PayPal the process goes like this:
– order is placed, and is pending payment
– user goes to paypal and makes a payment
– PayPal IPN message is received, order is updated to "processing"
– email is sent to user
However this e-mail does not have the payment info in it. The variables are empty. If I re-send the same e-mail manually it works as expected. other automated e-mails that go out during the order process work fine, it's just that initial e-mail that's missing the information.
What I don’t get is why it's missing the first time, when the PayPal IPN is received, and the transaction info with it, before the e-mail is even sent.
Since the IPN is received before the e-mail is sent why is that info not in the e-mail? If I go to the order and re-send the “processing” e-mail it has the info that we want it to show.
Or maybe even a way to have PayPal orders automatically put "on hold" would work, then when I manually change the order status the e-mail would be sent with the correct information.

Amazon FPS 400 Invalid Subscrption when Cancelling Valid Subscription

Thank you for taking the time to look at my question.
I'm using django on an ubuntu box.
I developed an 'upgrade account' feature for a client. The user clicks a button which then sends an api request to cancel their current subscription and redirects the user to amazon to create a new one.
It worked perfectly in sandbox.
In the first couple of weeks after deployment I've gotten a few errors from the cancel method: invalid subscription id. I checked the subscription id that was reported as invalid and it matches exactly to the subscription id on the client's amazon payment interface.
Does anyone have any idea why this would happen?
Below is the error message I received:
Error Message:
FPS Response Error: 400 ResponseError
Undefined response error.
Subscription Id xxxxxxxxxx is invalid.
This has never been successful in production.
I've also posted this question in the aws forum, with no response.
Please help!!
Just in case anyone comes up with the same question:
The boto app uses the fps sandbox as the default endpoint. I needed to change this in order
for it to work.
Like so:
kwargs = {'host' : simplepay.FPS_HOST}
fps_conn = FPSConnection(simplepay.ACCESS_KEY,
simplepay.SECRET_KEY, **kwargs)
Where FPS_HOST,ACCESS_KEY AND SECRET_KEY are defined in my apps' init.py and determined by whether debug is true or not.