What type of API does Razorpay provide?
Razorpay uses a REST API. The key points are:
-
Razorpay APIs are completely RESTful, with responses returned in JSON format.
-
The API uses standard REST conventions:
- Base URL:
https://api.razorpay.com/v1
- Resources are accessed via endpoints (e.g.
/payments
)
- It uses HTTP methods like GET, POST, etc.
- Responses are returned in JSON format
-
The API follows REST principles like:
- Stateless interactions
- Resource-based URLs
- Use of standard HTTP methods
-
It supports versioning, with v1 being the current version for most APIs.
-
The documentation provides details on authentication, error handling, pagination, and other typical REST API features.
Does the Razorpay API have webhooks?
Yes, the official Razorpay API does have webhooks. Here are the key points about Razorpay webhooks:
Webhook Availability
- Razorpay offers webhooks as part of their API to allow developers to receive event notifications.
- Webhooks can be set up from the Razorpay Dashboard for both Live and Test modes.
Types of Events
You can subscribe to various webhook events, including:
-
Payment events:
- payment.authorized: When a payment is in the authorized state.
- payment.captured: When a payment is in the captured state.
- payment.failed: When a payment attempt fails.
-
Order events:
- order.paid: When an order is paid.
-
Payment Link events:
- payment_link.paid: When a payment is made using a Payment Link.
-
Other events related to subscriptions, payouts, and more (specific events not listed in the search results).
Key Considerations
- You can set up to 30 URLs to receive webhook notifications for Razorpay Payments.
- For RazorpayX, currently only one webhook is allowed per Merchant ID.
- Webhooks are delivered in near real-time and are asynchronous.
- Razorpay follows an at-least-once delivery semantics, which means you may receive the same event multiple times.
Best Practices
- Use HTTPS for receiving webhook events.
- Verify the webhook signature to ensure events are sent from Razorpay.
- Handle duplicate events by implementing idempotency.
- Be prepared for events to arrive out of order.
- Respond with a 2xx status code when successfully processing a webhook to avoid unnecessary retries.
By subscribing to these webhook events, you can receive real-time notifications about various activities in your Razorpay account and take appropriate actions in your application.
Rate Limits and other limitations
The Razorpay API documentation does not explicitly mention specific rate limits for their API. However, there are some key points to consider regarding API usage and best practices:
API Gateway URL
The Razorpay API Gateway URL is https://api.razorpay.com/v1. This is the base URL that needs to be included before each API endpoint to make API calls.
Versioning
Razorpay APIs are backwards-compatible. If an API or its parameters are deprecated, Razorpay adds a warning note for a specific period of time.
Test and Live Mode
Razorpay APIs can be used in two modes: Test and Live. Each mode has different API keys.
Pagination and Rate Limiting
While specific rate limits are not mentioned, the documentation does reference a section on "Pagination and Rate Limiting" under Related Information. This suggests that there are indeed rate limits in place, but the details are not provided in the given search results.
Best Practices
The documentation mentions a section on "API Best Practices". While we don't have the specific details, it's likely that this section includes recommendations on how to use the API efficiently and avoid hitting rate limits.
Key Considerations
- Always use the correct API Gateway URL for your requests.
- Be aware of the different API keys for Test and Live modes.
- Implement proper error handling to deal with potential rate limit errors.
- Consider implementing pagination in your requests to efficiently handle large datasets.
- Follow Razorpay's API best practices to ensure optimal usage of the API.
Recommendation
To get specific information about API rate limits, it would be best to:
- Check the "Pagination and Rate Limiting" section in the full documentation.
- Contact Razorpay's support team for detailed information about rate limits.
- Implement proper monitoring and logging in your application to track API usage and identify any rate limit issues.
Remember that API rate limits can change over time, so it's important to stay updated with Razorpay's latest documentation and announcements regarding their API usage policies.
Latest API Version
Based on the search results provided, here are the key points regarding the most recent version of the Razorpay API:
API Version
The most recent version of the Razorpay API appears to be v1 for most endpoints, with v2 being used for Partners APIs. Specifically:
- The main API Gateway URL is
https://api.razorpay.com/v1
- The Partners API Gateway URL is
https://api.razorpay.com/v2
Key Points
-
Razorpay APIs are backwards-compatible. If an API or its parameters are deprecated, Razorpay adds a warning note for a specific period of time.
-
All Razorpay APIs are RESTful, and responses are returned in JSON format.
-
The API can be used in two modes: Test and Live. Each mode has different API keys.
-
The latest version of the Razorpay Node.js SDK is 2.9.4, as of the search results provided.
Best Practices
-
Always include the API Gateway URL (https://api.razorpay.com/v1
) before each API endpoint when making API calls.
-
Use the appropriate API keys for Test and Live modes. These can be obtained from the Razorpay dashboard.
-
When using the Node.js SDK, instantiate the Razorpay instance with your key_id
and key_secret
.
-
The SDK supports both promise-based and callback-based approaches for handling API responses.
It's important to note that while these details are accurate based on the provided search results, it's always recommended to check the official Razorpay documentation for the most up-to-date information on API versions and usage.
How to get a Razorpay developer account and API Keys?
To get a developer account for Razorpay and create an API integration, follow these steps:
-
Sign up for a Razorpay account:
- Go to the Razorpay website and sign up for an account if you don't already have one.
-
Access the Razorpay Dashboard:
- Log in to your Razorpay Dashboard using your credentials.
-
Generate API Keys:
- In the Dashboard, navigate to Account & Settings → API Keys (under Website and app settings).
- Click on "Generate Key" to create new API keys.
-
Choose the mode:
- Select either Test mode or Live mode, depending on your current needs.
- Test mode is for integration testing and doesn't process real payments.
- Live mode is for accepting actual customer payments.
-
Save your API Keys:
- After generating the keys, download and save them securely.
- The API key consists of a key_id and key_secret.
What can you do with the Razorpay API?
Based on the information provided in the search results, here is a list of data models you can interact with using the Razorpay API, along with what is possible for each:
Payments
- Create and manage payment transactions
- Fetch payment details
- Capture authorized payments
- Refund payments
- Void authorized payments
- Support for multiple payment methods including cards, UPI, netbanking
Linked Accounts
- Create and manage linked accounts for splitting payments
- Transfer funds to linked accounts
- Manage settlements and reconciliations for linked accounts
Transfers
- Create multiple payment transfers to split funds between parties
- Facilitate instant transfers to recipients
Customers
- Create and manage customer profiles
- Store customer payment information securely
Subscriptions
- Set up recurring payment plans
- Manage subscription lifecycles
- Support for card, UPI mandate, and netbanking e-mandate recurring payments
Invoices
- Generate and send invoices
- Track invoice status and payments
Refunds
- Process refunds for payments
- Manage refund status and reconciliation
Settlements
- View and manage settlement reports
- Track funds transfer to bank account
Webhooks
- Configure webhook endpoints to receive real-time notifications
- Receive updates on payment status changes, refunds, transfers, etc.
Payment Links
- Create shareable payment links
- Track status of payments made through links
Virtual Accounts
- Create and manage virtual bank accounts for collections
Reports and Analytics
- Generate transaction reports
- Access payment analytics and insights
API Keys and Authentication
- Manage API keys for authentication
- Switch between test and live modes
Key points to consider:
- Razorpay APIs are RESTful and return responses in JSON format
- Both test and live modes are available with separate API keys
- The API supports versioning for backwards compatibility
- Rate limiting and pagination are implemented for API requests
- Proper error handling and security best practices should be followed when using the API