Razorpay Recurring Payment In Android

- 1 answer

I am using Razorpay for the payment purpose in my Android app.

compile project(':razorpay-android-2.0.1')

Currently, payments are working fine.

Now I need to implement recurring payment (Auto-renew / subscription) using Razorpay.

I couldn't find any clean docs for the same. Please feel free to update me with valuable info.



Finally, I found it myself.

There are 3 main steps:

  1. Define a plan that sets what amount should be billed and how often.
  2. Create a subscription for the selected plan with the start and end details.
  3. Create an authentication transaction (auth transaction).

But, All of these three steps are to be implemented from the backend.

From the front end side (Android app) we need to do the following:

  1. Need to fetch all the plan_id from the backend
  2. Send the particular plan id for which we need the subscription and backend will generate a subscription_id.
  3. Fetch the subscription_id created in the backend
  4. During razorpay payment, add two extra parameters "subscription_id" & "recurring". Set recurring as 1.
  5. Send the transaction_id to backend which we get on payment success.

FYI. I used the sdk "com.razorpay:checkout:1.4.5"

Happy Coding.