Hi.

I'm working on a site I'm really excited about, and really need a way for users to upgrade their paypal subscription from one role/price to another. I scoured the paypal docs, and found that the only ways to accomplish this are to either modify the subscription, or cancel it and have them add a new one. In my case, I need to be able to charge the difference when someone completes an upgrade.

I need this in a hurry, so I'm going to have to add this functionality to the code myself to get it working quickly, but it will only work for my own site, since it's going to be sort of a hack until I can go in later and clean it up :). I can upload the changes later if this is something everyone wants, or someone else can make the changes. Here is what I am doing:

1. Add fields to lm_paypal_subscriptions that indicate: a) is this an upgrade/downgrade button? b) whether to charge the difference for an upgrade c) whther to refund the difference for a downgrade

2. The upgrade/downgrade options then needs to be added to the add new and edit subscription forms as a checkbox or something.

3. When printing the fields for an upgrade/downgrade button, the following hidden field needs to be added:
$form .= "<input type=\"hidden\" name=\"modify\" value=\"1\">\n";

4. Warnings need to be added to the upgrade/downgrade option (IF a refund will be issued, or extra charges apply) that the user must click the return to host button from paypal and then click on the complete upgrade option in order for their upgrade/downgrade to take effect (of course, the downgrade in role will actually take place right after the modify, but the refund won't be issued until the complete it).

5. The return page for the modify must then come back to a specific page to complete the upgrade. It does not yet go to whatever return page the person indicated until the upgrade is complete. For a downgrade (or when the person does not want the difference in charges applied), the transaction is complete, and the return page is shown. In the case of a downgrade where a refund will be issued for the difference in the time remaining for the subscription, this is where the role is downgraded, but the do not get their refund until they complete the transaction.

6. The new page will have another button which will complete the upgrade/downgrade. This page automatically makes the following calculation for an upgrade: ((NewSubscriptionPrice-OldSubscriptionPrice)/TotalDaysInSubscriptionPeriod)*DaysRemaining, and puts that amount as the amount to pay. DaysRemaining is how many days are left in their subscription period from today (the day of the upgrade). A similar calculation would be performed to find a refund amount.

7. As soon as that payment goes through, the role is upgraded (if it's an upgrade), and the return page specified is shown.

-Kristen

Comments

ddyrr’s picture

That modify line should have value=2. This indicates the option is for modify only. value=1 means it can be used for adding OR modifying a subscription

davero6’s picture

Version: master » 6.x-1.0
Priority: Normal » Critical

My problem is the user subcribes via LM paypal, i get paid, but they do not have their role upgraded and my site still shows them as being unsubscribed.
how do we correct this?