3

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.

Kos
  • 4,890
  • 9
  • 38
  • 42
Newbie
  • 368
  • 3
  • 12

2 Answers2

9

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.

Newbie
  • 368
  • 3
  • 12
1

Thanks for posting the question. You can find the API Reference here.

To explain the flow in simple 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). The auth transaction is an approval process that grants permission to charge the customer's card on a periodic basis. This is an important and mandatory step while creating a subscription.

Let me know if this was helpful.

aroras
  • 11
  • 1
  • Hey @aroras, I have gone through this reference already. Can you please get me a piece of code for the same? Then it will be helpful for me. – Newbie Feb 07 '18 at 04:33
  • @Newbie did you get through this? I could not find any reference for subscriptions in their Android SDK documentation. – binaryKarmic Jun 27 '18 at 05:52
  • 1
    @binaryKarmic Added the answer. Check it. If you have any questions or concerns, don't hesitate to let me know. – Newbie Jun 29 '18 at 05:36