I've been looking all over the internet, played with ipn a bit, but can't figure out how to get paypal to work with subscriptions (monthly). Any advice on how to get monthly subscriptions to work, and update the database if they paid, or cancelled? Thanks for any help.
here is some sample code from paypal. Paypal gives you a return after the completion of the request. So you need a file on your webserver and paypal gives you automaticly a return to this file. Then you can insert it to your database.
And from your database you can generate reports. when you don't understand the example you should look more on php first.
I hop this was your question.
Look at the txn_type's provided in https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_html_IPNandPDTVariables and https://www.paypalobjects.com/en_US/ebook/subscriptions/Appx-ipn_subscription_variables.html and code the IPN script accordingly. You should see these txn_type's in your subscription IPN's as well.
E.g.
if($_POST['txn_type'] == "recurring_payment") {
// update database
}
Of course, you'll still need to POST the data back to PayPal in order to validate it. But checking the txn_type should give you enough granularity to update your database accordingly.
Keep in mind that 'subscriptions' starting with I- are actually 'recurring payments'. Subscriptions start with S-. These are legacy and thus you shouldn't see these any longer, but it's good to keep this in the back of your mind anyway.
Related
I really need help because I don't know what to do at this point. I developed a website where the new user need to pay for sign up, I set the correct paypal form button and about the money everything works ok, the problem is that I can't update my database. I'm using these files (they are provided on gitHub and also in the official Paypal guide there's a link to them): "PaypalIPN.php" and "example_usage.php". I also added to my Ubuntu cloud server (where is my website) the cert/cacert.pem, I don't know if I had to do but in the first file seems to be required.
I tried to run a IPN simulator but it doesn't work, I looked for the same problem and I found that there may be a problem with the simulator, so I made some real transactions (I've read that live production test is run correctly with that code).
Therefore:
the transaction money is ok;
in the Instant payment notification history there are all test I made and in message ID I can read the correct data passed in the IPN message, the IPN type is "Transaction executed" and the response code is 200. I noticed that in "example_usage.php" the 200 response code was out of the if ($verified) so, just for my last test, I put that inside the if and yes, the response was again that;
I tried my code for update the mongodb database with fake data and obviously it works.
How is it possible? Please, help me and thank you.
Did you verify the correct URL is showing in the IPN History details? Sometimes people are using a button that uses notify_url to override the PayPal account setting, and then IPNs are working, but they're going to a different place than expected. So check that first.
If the IPN is indeed going to the URL you expect, and it's returning a 200 OK, that means it's receiving and completing the script successfully. If you aren't seeing the expected result in your database then you must have some sort of a logic problem with your code that needs to be addressed. You need to build in some trackers to log files or send yourself emails as it does each step of your script to see if that portion of code is actually getting hit like you think it is.
I put together this article for how to test PayPal IPN a while back that has proven helpful for many people. If you follow the steps there you should be able to track down the problem.
The paypal IPN simulator "currently" (As in I'm assuming never will) does not have functionality to test the subscr_payment payment option, this is really putting a dead hault in my project. I've read that I can just create a button that simulates this, but I don't have a clue how and after looking I can't find any information on it.
I'm creating a subscription based system for hosting a special type of website, I have everything done besides for the subscription model now and it seems like it's going to be the hardest part.
It is completely possible to test recurring billing with Paypal.
There are multiple ways possible for this.
One is the paypal subscribe button and another way (which i have used) is via a subscription form.
For the subscribe button you can refer this documentation, it contains all the information you need to setup this.
For second method, you need to create a form and place all the required variable in that form.
All the required variables are listed here.
I hope this helps.
Hopefully this workaround will help you. From within the PayPal developer site, you can go to the IPN simulator, select Transaction Type as Web Accept, click Show All Fields. You can then edit txn_type to be subscr_payment, subscr_signup, etc.
It's not perfect, as it doesn't give you all of the variables, but you can put info in other entries, and use a logical to determine whether or not the correct entry exists.
Do one test subscription, so that you have the values, and then work from there.
Sorry for the very basic nature of the question, but I've been searching for two days and I'm still not sure how to do this.
I've got a paypal cart/store set up. How do I leverage either paypal IPN or a third party service to identify one specific item of the three items I have for sale, and send me a notification that a copy has been purchased, and then update a counter on my original website?
Again, just suggestions or a guideline would be greatly appreciated - even to point me in the right direction. Thank you.
A basic guideline for you:
have a sandbox account (I assume you already do)
create there a seller and buyer account
set IPN setting for seller account to your testing URL (where you will be checking for certain data returned)
for the URL mentioned above create a php file with IPN validator
and go here https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_html_IPNandPDTVariables#id08CTB0S055Z to check variables you will be searching for.
I assume you would need to pick num_cart_items and loop throug possible item_nameX variables returned.
You don't need to code anything to validate IPN, use some of these classes:
http://www.micahcarrick.com/php-paypal-ipn-integration-class.html
http://www.phpclasses.org/package/2249-PHP-Process-Paypal-payment-interactions.html
I'm designing a database system, which sells courses to students. This is all done within PHP. I want to take Paypal payments on my website and having done some research I need IPN.
I've been reading docs/guides on how to achieve this from www.x.com but its quite confusing to find info I need as there seems to be more than one way of doing something. The IPN stuff looks pretty straight forward, paypal just needs the unique Invoice number, which the notify script uses to retrieve the record and post the appropriate response into a database and if all goes well, redirect page to a thank you.
The thing is which method do I initially send my values across to Paypal, I don't really want to pass on quantity and shipping data as all of these pieces of data are irrelevant I don't want my end user to see. Do I have to start looking at using the paypal api?
Thanks for the advice
Since your question seems to be "where should i start looking for a good paypal integration with php" i'll give you some general "advice". I had the same problem just a couple of months ago.
Yes you've to read paypal docs, and unfortunatly they don't have the gift of clarity.. very complete but i didn't find them very clear.
However this php class has been very helpful for my similar project: https://github.com/Quixotix/PHP-PayPal-IPN hope can help you too.
Also these articles/classes/docs has been helpful (but at the end i'm not using them) to clear my mind about PP integration:
http://drewjoh.com/wiki/code/classes/phppaypal
http://www.geekality.net/2011/05/28/php-tutorial-paypal-instant-payment-notification-ipn/
set up a sandbox account https://developer.paypal.com/
then go through some of the tutorials
you will also need to set up some test accounts, pay attention to the nav on the left (from the developers page). It has everything you need
I have a client who will be selling access to an online service on their website. They would like to integrate a PayPal Buy Now button into the site... no problems there. However, they want their customers to have instant access to the online service that they are selling as soon as the payment is processed. That seems reasonable to me... the problem is that I can't seem to find a way to automate that. So my question is really this:
How can I automatically alert my php/mysql web app that a PayPal transaction has gone through?
All I would really need is like a callback process that triggers a php script to updates the customer's record in the database... right? Seems simple to me. But I can't seem to find a way to do it! Anyway, if you've accomplished anything similar with PayPal, I'd be grateful for your advice!
See Instant Payment Notification.
I think you want to send in a variable to paypal (item_number) that they will return to a page that you specify in your post to them (return - success and cancel_return - cancel). They will send you back whether the transaction was successful or not and then with your variable you can make a call to your db to update the record in your database based upon the result of the transaction. In the return page you can also send some sort of notification to the client of the success or failure of the payment process and clean up after a canceled transaction.
PayPal maintains an extensive knowledge base on how to integrate their services with your web app. In think that is a good first starting point. See www.x.com