How to Handle Cancelled Recurring Payments - paypal

I'm using Paypal to handle automated recurring payments for my website. Users pay to subscribe to my website so they can get periodic newsletters.
So let's say a customer cancels their membership a few months later. They do this by logging into Paypal and cancels future automated payments. How should I update my website to reflect this cancellation?
The first solution I'm thinking of is to schedule a cronjob that executes a script every midnight to update my database with information from Paypal.
The second solution is on newsletter mailout day, I execute a script to update my database with information from Paypal. The website will also execute the script every time a user "logs in" to my website.
Are there better ways to do this?

If I understand correctly, Paypal's servers will update yours automatically when the status of a subscription changes, if you have this configured. This is called IPN (Instant Payment Notification) and does indeed include cancellation notification. Here's the Paypal documentation for recurring (subscription) payments. Additionally you can poll their servers using their API for this information, so if you'd prefer to fetch it yourself, you can.

Related

PayPal Subscriptions - Tracking Refund

I'm not a developer, but a project manager. So please excuse my lack of proper language.
We are trying to figure out how to handle subscription refunds and then limit account access on the site.
Here's a scenario. Member signs up for an annual subscription to gain certain capabilities in the account. 3 months into it member decides to cancel and requests a refund. Normally, if no refund is issued, subscription is good until the end of the billing period, at which point account is deactivated.
In our case, if a refund is issued, account should be deactivated immediately. Question: is it possible to set this up as part of PayPal Subscriptions? Some type of call from PayPal to our system that will trigger account deactivation.
Thank you.
We recommend using IPN (Instant Payment Notifications) to be asynchronously notified of any events, in this case of those related to existing subscription/recurring payments.
https://developer.paypal.com/webapps/developer/docs/classic/ipn/gs_IPN/
If you enable IPN notifications you will receive a POST of PayPal in the following events (among others):
When a recurring profile is cancelled.
When a refund has been made to a previous completed transaction.
This way, you can set up your IPN script to keep the subscription “open” in your side for the remainder of the month even if the profile has been cancelled, or to deactivate it if the last month has been refunded.
For more information about IPN variables:
https://developer.paypal.com/docs/classic/ipn/integration-guide/IPNandPDTVariables/

Paypal recurring payment change account and decline

My customer is using recurring payment. I have two problem to resolve:
Case 1 : My a customer have some recurring bill. This want change these recurring bill to other paypal account. Is there paypal api to support to delete recurring bills in current account and renew thes bills to new account.
Case 2 : If due to payment,customer's paypal account is not enough money, my system will lock some customer's function. I want paypal call my system 's function to handle this. Is there a way to resolve my problem.
1) You can use ManageRecurringPaymentsProfileStatus to cancel/suspend the profile on the existing account. You'll need to have the user go through the process of creating the new profile on the new account, but this can be done via the use of CreateRecurringPaymentsProfile.
If you happen to be working with PHP my class library for PayPal will make these calls very simple for you.
2) You'll want to utilize Instant Payment Notification (IPN) to automate the management of the profiles. PayPal will POST transaction data in real-time to a listener script that you have setup on your web server. This script can receive that data and then update your database, send out email notifications, hit 3rd party services, or whatever you want to do from within it.
PayPal will send an IPN when a profile is created, updated, suspended, canceled, as well as when payments are completed, failed, skipped, etc.

Paypal Recurring api for find next recurring payment occure

i has been implemented paypal recurring subscription plan in php and paypal recurring also charge via paypal as per recurring periods. but my system didnt find out next recurring was charged or not so how could i know next recurring payment has been charged using paypal api.
i want to help for to upgrade next expire date after next recurring payment changed.
As I understood, you want to see if the user paid or not and change expiration date according to that.
The solution is Webhooks. In your PayPal Application section click on add webhook and choose PAYMENT.SALE.COMPLETED and enter the URL that you want to listen to this event where PayPal will send a post request to this URL when you get a new payment completed.
In the page that corresponds to the URL you entered, you have to do the followings:
Verify that the call is from PayPal, not from another source (in case you are using PHP you can check this: PHP verify Paypal webhook signature)
Parse the data sent from PayPal by reading the body content, not the POST data
Verify that the event is what you need, in this case PAYMENT.SALE.COMPLETED
Verify the amount you received and the currency
Make sure that you have not processed this transaction before and this is too important
If everything is valid, you can save the transaction and do whatever you want, in your case extending the expiry date.
If I understand you correctly, you need to configure Instant Payment Notification (IPN). PayPal's server will POST transaction data to a listener script you have on your server so you can process things accordingly. It happens in real-time.
When working with recurring payments you'll get an IPN when a profile is created, canceled, or suspended, and you'll also get notifications when payments for profiles are completed, failed, etc. You can update your system or send out email notifications accordingly based on the IPN data you get.

PayPal Subscription Cancellation from Merchant Website

we have a paypal payment system integrated into our website so people can register and choose a subscription. The subscription part works fine as the payment goes through and the IPN hits our website and updates our systems. Now we want users to be able to cancel their subscription from within our website so we have a custom cancellation button which when clients click, should send a request to paypal and cancel their subscription. We managed to get this going on sandbox test system however since we have brought the system into live testing we can not get the cancellation feature to work. So currently when the user clicks on cancel button, i think paypal is not being notified and hence no IPN received from PayPal.
Do you know what all info we need in order to cancel the subscription from our website. I know there is a way where users can log into paypal and cancel their subscription or we can log into our paypal and cancel their subscription but we want it to work from our website.
Please help!
Thanks.
When you say you have it working on the sandbox but not live, what exactly is going wrong when you try it live?
I'm actually a little confused by that, because my initial answer was going to be that you can't kill subscriptions via the API unless you're using Recurring Payments. Standard subscriptions aren't accessible via the API.
If you're saying you're doing that in the sandbox, though, then there must be something I'm unaware of..??
On that note, I know the PayPal system pretty well, so I'm thinking maybe you did Recurring Payments on the sandbox, but live you're using Standard Subscriptions..?? If that's accurate then you'll need to move to recurring payments instead of standard subscriptions on the live site.

How does paypal notify you that a user has successfully paid

If we use a paypal buy it now button, how are we notified that a user has completed their transaction?
I'm guessing there is a way other than checking our email and past transactions?
I'm language agnostic at this point, so any sample code would be a great help
Thanks
Paypal has a system called Instant Payment Notification.
Instant Payment Notification (IPN) is a message service that notifies you of events related to PayPal transactions. You can use it to automate back-office and administrative functions, such as fulfilling orders, tracking customers, and providing status and other information related to a transaction.
The linked page should have all the information you need to get set up.