Recently our team started a new project, in which we need to develop subscription using Paypal. At first glance, it seemed to be a very easily implementable feature. But when we started working on it, we faced lots of issues. This post is about the problem we encountered and steps we took to overcome them in the hope of helping you out if you are also facing similar issues with implementing Paypal Subscription feature to your website
First of all, Paypal subscription can be implemented using 2 ways: subscription buttons and APIs. This post is mainly about the former option, i.e. Subscription buttons. These are quick and easy to implement. So we choose this option.
Subscription button implementation requires an HTML form requiring some inputs according to the variables defined in Paypal documentation. Here is the Paypal official link for subscribe button implementation.
Another important link required in the process is the one that describes the variables for HTML form.
After clicking on the subscribe button, the user gets redirected to Paypal, where he needs to login and review payment data. Once user confirms the payment, it returns to the URL provided in the form.
What we did is as follows stepwise:
Step 1: We integrated the HTML form according to the steps required by the Paypal.
Step 2: Our next step was to save the data of subscription and subscriber id in our database. For this there are 2 methods: first is IPN (Instant Payment Notifications) and second is PDT (Payment Data Transfer).
For our part, we developed the return URL according to PDT, as it returns the data after payment is processed successfully.
Till now everything was fine.
Step 3: For the next step, we had to implement the upgrade subscription package. We followed the official document exactly as it asked.
Now the problem started appearing. During the testing phase, it was noticed that the express checkout doesn’t allow upgrading more than 20% of previous amount within 180 days of subscription. It came as a shock to us, since this was nowhere mentioned in the document.
It was then we tried the alternate option i.e. API as guided in this page. To our surprise, even this option had its restriction: it does not allow upgrading to more than 120% of the previous subscription amount within 180 days of subscription. However, this important piece of information was also not mentioned in document. It can only be known after getting the API response.
The only plausible option left to was to cancel the previous subscription and create a new subscription for upgrade case. This was confirmed in the testing phase and we had to do all the calculations manually to make the upgrade possible for our customers.
The results we were looking for got finally delivered.
Step 4: In the next phase, client added the requirement that he wants a “free trial” to be added in subscription for first signup. Accordingly, we then added trial variables as dictated by the document and submitted the form. The process run as before and form returns to the return URL.
However, no data is returned in PDT due to it being a free trial, which is why we were not able to save subscriber id. The same was found true for the IPN method testing.
Customer support was another setback as it took 1-2 days to respond and even then did not have any solution to the problem. They suggested the same thing we had already implemented but did not have any answer to our issues.
We got stuck here.
We had to restart the development and had to select the API method for implementation. The API uses a different term for subscription, which is ‘Billing Agreements’; this was also quite confusing for us initially. But it was the only solution to have worked for us.
Here are some key points from the whole experience:
Here are some useful links to develop billing agreement API in Paypal:
We hope that the blog is useful to those facing similar issues.
Wish to discuss a project ?