Subscription Automation for IFF

Over the past couple of months, we have been working to build a few automation pieces for the Internet Freedom Foundation’s donation processing systems especially for the recurring giving program i.e. the IFF memberships. We are reaching towards the final few steps of this project and ready to tell the larger Internet Freedom community about this.

For some context, all our membership payments happen through Razorpay (Payment Gateway). Until recently we only had a provision to create recurring subscriptions for a limited number of Credit Cards, this changed when Razorpay started supporting e-Mandate. E-Mandate is a new payment service that allows anyone with a bank account/debit card to easily automate recurring payments. However, unlike the credit card based subscription, the recurring payment had to be deducted manually every month from the Razorpay dashboard, which is a time-consuming and quite likely a more error prone process. You can find more information on E-Mandate here.

Kickstarting The Project

In April, the IFF team started to look for ways to find a system for sending welcome emails, generating 80G certificates without much human intervention if at all any, the platform we found the best for this was ERPNext. It is a popular FOSS(Free and open-source software) product, built by Frappe Technologies in Mumbai. A conversation started with the Frappe team, and they agreed to volunteer for this project. ERPNext already had a Non Profit Module which we would use to keep track of our membership payments and more. Over the next few months, we migrated our members’ list to ERPNext, Shivam from the Frappe team wrote custom endpoints that were triggered by the Razorpay webhooks when any new subscription payment was made. This was a relatively painless process, with only a few hiccups coming our way. All the new features were added to the ERPNext codebase directly, ensuring that any other non-profit can take full benefit of this.

Time for an E-Mandate

The next piece was getting E-Mandate up and running. The team (@TheJoker, @farkhanda, @karthik, @shivam and @Shivani) started to carry this project forward. The next couple of months involved a lot of calls within the team, calls with the Razorpay integration team and quite a few experiments. The Razorpay documentation for this particular feature was a bit confusing to begin with, (which is unlike their other products), however a call with their integration team did solve all our doubts. We did quite a bit of sprinting between documentation pages to figure the exact flow of the payments, but once it all came together we were able to write the pieces for this code. We are extremely grateful to the RazorPay team for this product, it has the potential to be a boon for the nonprofit sector.

The following is the e-mandate flow marked E1, E2, E3 in the diagram

  1. Member details are sent to E Mandate Lambda
  2. The lambda calls Razorpay with the details, which generates a token and returns it back, which is sent to ERPNext and the IFF Website to trigger payment
  3. Once the token is received we pass it along with the generated customer ID to ERPNext which stores the details for future use
  4. The token has to be confirmed by the bank, which takes a while to process, when it is confirmed a web hook is triggered which ERPNext listens to, and updates the token status in it’s database
  5. Following this, every subsequent month, depending on the plan the member is on, the payment is triggered via Razorpay API from ERPNext

We put this system in place, after a few weeks of testing we finally are live with E-Mandate payments on our donate page, which essentially means that we have been able to fully automate the recurring payments through E-Mandate and will be able to sign-up members through NetBanking and Debit Cards.

Future Enhancements

We started working on this custom integration using e-mandate mainly because Razorpay does not natively support inbuilt-scheduling for e-mandate based recurring payments.

On July 23rd Razorpay announced UPI Autopay, which offers features like inbuilt scheduler among other things, at the convenience of UPI apps customers are already familiar with. But as of writing this post, Razorpay has confirmed that it will take a while until all the above said features are enabled on their end. We plan on integrating UPI subscriptions when it goes live and is stable enough for our purposes.

If you’re a non-profit like us, we highly recommend to keep looking out for this feature and make use of it whenever possible.

Conclusion

All the code we created during the course of this project has been published under a free license allowing anyone to use it for their non-profits. Following are the links to those project repositories:

  1. ERPNext
  2. E-Mandate Integration for ERPNext
  3. Razorpay Lambda (AWS) for E-Mandate
10 Likes

After months of work and endless calls and emails we have successfully been able to implement the e-Mandate payments for our recurring donations. This means that we have been able to fully automate the recurring payments through e-Mandates and will be able to sign-up members through NetBanking and Debit Cards. You can easily joining our membership program through any of these payment options now. We request our forum community to become IFF members today!

We believe that it’s incredibly important for us to incorporate technology in our ways of work to improve operational efficiency and increase our mission impact. As technology is advancing we are also adapting innovative methods of data management, processing and payments. We have documented the entire implementation process in the above post and published the code created during the course of this project under a free license allowing anyone to use it. If you are an organisation trying to set up your donation systems and want more details or support on building this out, feel free to get in touch with us at [email protected] and we would be happy to talk more about it!

In case you don’t have the resources to build out the system from scratch we suggest looking at DanaMojo to set up the donation system for your organisation. Danamojo is an online payment solution platform that you can opt for if you are looking to set up a recurring giving system for your organisation that supports Credit cards, Debit cards, Netbanking via 36 banks and UPI. This platform requires no coding effort and setting it up along with the integration can be done in less than two minutes.

Here’s a video on how this platform works for the donor: https://youtu.be/nAfI9KW3aEc