API Test Keys
Fetch All Subscriptions
GET/v1/subscriptionsClick to copy
Use this endpoint to fetch all the created Subscriptions.
Is this page helpful?
1curl -u [YOUR_KEY_ID]:[YOUR_KEY_SECRET] \2-X GET https://api.razorpay.com/v1/subscriptions \
Success
Failure
1{2"entity": "collection",3"count": 2,4"items": [5{6"id": "sub_00000000000001",7"entity": "subscription",8"plan_id": "plan_00000000000001",9"customer_id": "cust_D00000000000001",10"status": "active",11"current_start": 1577355871,12"current_end": 1582655400,13"ended_at": null,14"quantity": 1,15"notes":{16"notes_key_1": "Tea, Earl Grey, Hot",17"notes_key_2": "Tea, Earl Grey… decaf."18},19"charge_at": 1577385991,20"offer_id":"offer_JHD834hjbxzhd38d",21"start_at": 1577385991,22"end_at": 1603737000,23"auth_attempts": 0,24"total_count": 6,25"paid_count": 1,26"customer_notify": true,27"created_at": 1577356081,28"expire_by": 1577485991,29"short_url": "https://rzp.io/i/z3b1R61A9",30"has_scheduled_changes": false,31"change_scheduled_at": null,32"remaining_count": 533},34{35"id": "sub_00000000000002",36"entity": "subscription",37"plan_id": "plan_00000000000001",38"customer_id":"cust_D00000000000001",39"status": "active",40"current_start": 1577355871,41"current_end": 1577355871,42"ended_at": null,43"quantity": 1,44"notes": {45"notes_key_1": "Tea, Earl Grey, Hot",46"notes_key_2": "Tea, Earl Grey… decaf."47},48"charge_at": 1561852800,49"start_at": 1561852800,50"end_at": 1590777000,51"auth_attempts": 0,52"total_count": 12,53"paid_count": 1,54"customer_notify": true,55"created_at": 1560241235,56"expire_by": 1561939199,57"short_url": "https://rzp.io/i/m0y0f",58"has_scheduled_changes": false,59"change_scheduled_at": null,60"source": "api",61"offer_id":"offer_JHD834hjbxzhd38d",62"remaining_count": 1163}64]65}
Query Parameters
plan_id stringThe unique identifier of the plan for which you want to retrieve all the Subscriptions.
from integerThe Unix timestamp from when Subscriptions are to be fetched.
to integerThe Unix timestamp till when Subscriptions are to be fetched.
count integer The number of Subscriptions to be fetched. Default value is 10. Maximum value is 100. This can be used for pagination, in combination with skip.
skip integer The number of Subscriptions to be skipped. Default value is 0. This can be used for pagination, in combination with count.
Response Parameters
idstringThe unique identifier linked to a Subscription.
entitystring The entity being created. Here, it is subscription.
plan_idstring The unique identifier of a plan that should be linked to the Subscription. For example, plan_00000000000001.
customer_idstringThe unique identifier of the customer who is subscribing to a plan. This is populated automatically after the customer completes the authorisation transaction.
total_countinteger The number of billing cycles for which the customer should be charged. For example, if a customer is buying a 1-year subscription billed on a bi-monthly basis, this value should be 6.
customer_notifybooleanIndicates whether the communication to the customer would be handled by businesses or Razorpay. Possible values:
true(default): Communication handled by Razorpay.false: Communication handled by businesses.
start_atinteger The Unix timestamp, indicates from when the Subscription should start. If not passed, the Subscription starts immediately after the authorisation payment. For example, 1581013800. For Subscriptions with a future start_date, frequency is considered as_presented.
quantityinteger The number of times the customer should be charged the plan amount per invoice. For example, a customer subscribes to use software. The charges are S$100.00/month/license. The customer wants 5 licenses. You should pass 5 as the quantity. The customer is charged S$500.00 (5 x S$100.00) monthly. By default, this value is set to 1.
notesobjectObject consisting of key value pairs as notes.
statusstringStatus of the Subscription. Possible values:
createdauthenticatedactivependinghaltedcancelledcompletedexpired
Know more about
.paid_countintegerIndicates the number of billing cycles the customer has already been charged.
current_startintegerIndicates the start time of the current billing cycle of a Subscription.
current_endintegerIndicates the end time of the current billing cycle of a Subscription.
ended_atintegerThe Unix timestamp of when the Subscription has completed its period or has been cancelled midway.
charge_atintegerThe Unix timestamp of when the next charge on the Subscription should be made.
auth_attemptsintegerThe number of times the charge for the current billing cycle has been attempted on the card.
expire_byinteger The Unix timestamp that indicates till when the customer can make the authorisation payment. For example, 1581013800. The default value is 30 years. Do not pass any value if you do not want to set an expiry date.
addonsarray of objectsArray that contains details of any upfront amount you want to collect as part of the authorisation transaction.
Show child parameters (1)
offer_idstring The unique identifier of the offer that is linked to the Subscription. You can obtain this from the Dashboard. For example, offer_JHD834hjbxzhd38d.
notesobject Notes you can enter for the contact for future reference. This is a key-value pair. You can enter a maximum of 15 key-value pairs. For example, "note_key": "Gym Membership Plan.
short_urlstring URL that can be used to make the authorisation payment. For example, https://rzp.io/i/PWtAiEo.
has_scheduled_changesbooleanIndicates if the Subscription has any scheduled changes. Possible values:
true: Subscription has scheduled changes.false: Subscription does not have scheduled changes.
schedule_change_atstringRepresents when the Subscription should be updated. Possible values:
now(default): Updates the Subscription immediately.cycle_end: Updates the Subscription at the end of the current billing cycle.
remaining_countinteger Indicates the number of billing cycles remaining on the Subscription. For example, 2.
Errors
The API key/secret provided is invalid.
Error Status: 4xx
This error occurs due to a mismatch between the API credentials passed in the API call and those generated on the Dashboard.
Solution
Fetch All Subscriptions
GET/v1/subscriptionsClick to copy
Use this endpoint to fetch all the created Subscriptions.
Is this page helpful?
Query Parameters
plan_id stringThe unique identifier of the plan for which you want to retrieve all the Subscriptions.
from integerThe Unix timestamp from when Subscriptions are to be fetched.
to integerThe Unix timestamp till when Subscriptions are to be fetched.
count integer The number of Subscriptions to be fetched. Default value is 10. Maximum value is 100. This can be used for pagination, in combination with skip.
skip integer The number of Subscriptions to be skipped. Default value is 0. This can be used for pagination, in combination with count.
Response Parameters
idstringThe unique identifier linked to a Subscription.
entitystring The entity being created. Here, it is subscription.
plan_idstring The unique identifier of a plan that should be linked to the Subscription. For example, plan_00000000000001.
customer_idstringThe unique identifier of the customer who is subscribing to a plan. This is populated automatically after the customer completes the authorisation transaction.
total_countinteger The number of billing cycles for which the customer should be charged. For example, if a customer is buying a 1-year subscription billed on a bi-monthly basis, this value should be 6.
customer_notifybooleanIndicates whether the communication to the customer would be handled by businesses or Razorpay. Possible values:
true(default): Communication handled by Razorpay.false: Communication handled by businesses.
start_atinteger The Unix timestamp, indicates from when the Subscription should start. If not passed, the Subscription starts immediately after the authorisation payment. For example, 1581013800. For Subscriptions with a future start_date, frequency is considered as_presented.
quantityinteger The number of times the customer should be charged the plan amount per invoice. For example, a customer subscribes to use software. The charges are S$100.00/month/license. The customer wants 5 licenses. You should pass 5 as the quantity. The customer is charged S$500.00 (5 x S$100.00) monthly. By default, this value is set to 1.
notesobjectObject consisting of key value pairs as notes.
statusstringStatus of the Subscription. Possible values:
createdauthenticatedactivependinghaltedcancelledcompletedexpired
Know more about
.paid_countintegerIndicates the number of billing cycles the customer has already been charged.
current_startintegerIndicates the start time of the current billing cycle of a Subscription.
current_endintegerIndicates the end time of the current billing cycle of a Subscription.
ended_atintegerThe Unix timestamp of when the Subscription has completed its period or has been cancelled midway.
charge_atintegerThe Unix timestamp of when the next charge on the Subscription should be made.
auth_attemptsintegerThe number of times the charge for the current billing cycle has been attempted on the card.
expire_byinteger The Unix timestamp that indicates till when the customer can make the authorisation payment. For example, 1581013800. The default value is 30 years. Do not pass any value if you do not want to set an expiry date.
addonsarray of objectsArray that contains details of any upfront amount you want to collect as part of the authorisation transaction.
Show child parameters (1)
offer_idstring The unique identifier of the offer that is linked to the Subscription. You can obtain this from the Dashboard. For example, offer_JHD834hjbxzhd38d.
notesobject Notes you can enter for the contact for future reference. This is a key-value pair. You can enter a maximum of 15 key-value pairs. For example, "note_key": "Gym Membership Plan.
short_urlstring URL that can be used to make the authorisation payment. For example, https://rzp.io/i/PWtAiEo.
has_scheduled_changesbooleanIndicates if the Subscription has any scheduled changes. Possible values:
true: Subscription has scheduled changes.false: Subscription does not have scheduled changes.
schedule_change_atstringRepresents when the Subscription should be updated. Possible values:
now(default): Updates the Subscription immediately.cycle_end: Updates the Subscription at the end of the current billing cycle.
remaining_countinteger Indicates the number of billing cycles remaining on the Subscription. For example, 2.
Errors
The API key/secret provided is invalid.
Error Status: 4xx
This error occurs due to a mismatch between the API credentials passed in the API call and those generated on the Dashboard.
Solution
1curl -u [YOUR_KEY_ID]:[YOUR_KEY_SECRET] \2-X GET https://api.razorpay.com/v1/subscriptions \
Success
Failure
1{2"entity": "collection",3"count": 2,4"items": [5{6"id": "sub_00000000000001",7"entity": "subscription",8"plan_id": "plan_00000000000001",9"customer_id": "cust_D00000000000001",10"status": "active",11"current_start": 1577355871,12"current_end": 1582655400,13"ended_at": null,14"quantity": 1,15"notes":{16"notes_key_1": "Tea, Earl Grey, Hot",17"notes_key_2": "Tea, Earl Grey… decaf."18},19"charge_at": 1577385991,20"offer_id":"offer_JHD834hjbxzhd38d",21"start_at": 1577385991,22"end_at": 1603737000,23"auth_attempts": 0,24"total_count": 6,25"paid_count": 1,26"customer_notify": true,27"created_at": 1577356081,28"expire_by": 1577485991,29"short_url": "https://rzp.io/i/z3b1R61A9",30"has_scheduled_changes": false,31"change_scheduled_at": null,32"remaining_count": 533},34{35"id": "sub_00000000000002",36"entity": "subscription",37"plan_id": "plan_00000000000001",38"customer_id":"cust_D00000000000001",39"status": "active",40"current_start": 1577355871,41"current_end": 1577355871,42"ended_at": null,43"quantity": 1,44"notes": {45"notes_key_1": "Tea, Earl Grey, Hot",46"notes_key_2": "Tea, Earl Grey… decaf."47},48"charge_at": 1561852800,49"start_at": 1561852800,50"end_at": 1590777000,51"auth_attempts": 0,52"total_count": 12,53"paid_count": 1,54"customer_notify": true,55"created_at": 1560241235,56"expire_by": 1561939199,57"short_url": "https://rzp.io/i/m0y0f",58"has_scheduled_changes": false,59"change_scheduled_at": null,60"source": "api",61"offer_id":"offer_JHD834hjbxzhd38d",62"remaining_count": 1163}64]65}