Steps and Issues while Applying Paypal Subscription Feature to a Website
27
Jul

Steps and Issues while Applying Paypal Subscription Feature to a Website

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

 

About adding the Paypal Subscription to the 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 IPN, we need to define the IPN URL in Seller profile. IPN integration process is defined here in the official website.
  • For PDT, we get payment notification in return URL immediately. Here is the official link for you to take a look.

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.

Our take

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.

Conclusion

Here are some key points from the whole experience:

  • Subscription button is not a professional method to implement, (so we certainly don’t know why it does exist in the first place!).
  • No updated document exists;
  • Customer support also doesn’t have any updated information regarding what’s going on with this.
  • The only way to develop subscription in Paypal is using API.

Here are some useful links to develop billing agreement API in Paypal:

https://developer.paypal.com/docs/integration/direct/billing-plans-and-agreements/

https://developer.paypal.com/docs/api/payments.billing-agreements

https://paypal.github.io/PayPal-PHP-SDK/

https://paypal.github.io/PayPal-PHP-SDK/sample/#billing

We hope that the blog is useful to those facing similar issues.

share
How IoT Transforms Building Automation Systems

How IoT Transforms Building Automation Systems

previous-blog-arrowPrevious

Introduction to Spark Structured Streaming

next-blog-arrowNext
Introduction to Spark Structured Streaming