EienONE Quickstart
Learn how to accept payments and send payouts using the EienONE API. Setup takes less than 5 minutes.
1. Install Library
2. Initialize SDK
const EienONE = new EienONE('sk_test_12345');
// Create a charge
const charge = await EienONE.charges.create({
amount: 2000,
currency: 'inr',
source: 'tok_mastercard',
description: 'Test Charge'
});
Authentication
The EienONE API uses API keys to authenticate requests. You can view and manage your API keys in the EienONE Dashboard at https://eienone.in.
Your secret API keys should be kept confidential and only stored on your own servers. Your account's secret API key can perform any API request to EienONE without restriction.
Authentication to the API at https://api.eienone.in is performed via HTTP Basic Auth. Provide your API key as the basic auth username value. You do not need to provide a password.
-u sk_test_4eC39HqLyjWDarjtT1zdp7dc:
Webhooks
EienONE can send webhook events that notify your application any time an event happens on your account. This is especially useful for events that are not triggered by a direct API request, like a dispute being created or a recurring payment succeeding.
Verifying Signatures
EienONE signs the webhook events it sends to your endpoints by including a signature in each event's EienONE-Signature header. This allows you to verify that the events were sent by EienONE, not by a third party.
Cross-Origin Resource Sharing (CORS)
The EienONE API supports Cross-Origin Resource Sharing (CORS) for all its REST API endpoints, allowing you to make requests directly from a React, Vue, or vanilla Javascript application in the browser.
NEVER use your secret API keys in client-side code! This exposes your account to complete compromise. ONLY use publishable API keys when making CORS requests from the browser.
Error Handling
EienONE uses conventional HTTP response codes to indicate the success or failure of an API request. In general: Codes in the 2xx range indicate success. Codes in the 4xx range indicate an error that failed given the information provided (e.g., a required parameter was omitted). Codes in the 5xx range indicate an error with EienONE's servers.
| Code | Type | Description |
|---|---|---|
| 400 - Bad Request | invalid_request_error | The request was unacceptable, often due to missing a required parameter. |
| 401 - Unauthorized | authentication_error | No valid API key provided. |
| 402 - Request Failed | card_error | The parameters were valid but the request failed. |
| 429 - Too Many Requests | rate_limit_error | Too many requests hit the API too quickly. We recommend an exponential backoff of your requests. |
Payouts
To send a payout to a bank account or UPI, you create a Payout object. You can send funds instantly via IMPS, NEFT, RTGS, or UPI.
Create a Payout
When you create a new payout, you must specify the amount, mode, and beneficiary details like beneficiaryName and account information. You can also provide optional fields such as beneficiaryPhone, beneficiaryEmail, bankName, and referenceId.
-H "X-API-Key: YOUR_API_KEY" \
-H "X-API-Secret: YOUR_API_SECRET" \
-H "Content-Type: application/json" \
-d '{ "amount": 1000, "mode": "IMPS", "beneficiaryName": "John Doe", "accountNumber": "1234567890", "ifscCode": "HDFC0001234", "beneficiaryPhone": "9876543210", "beneficiaryEmail": "john@example.com", "bankName": "HDFC Bank", "referenceId": "ORDER_12345" }'
Parameters
Amount intended to be sent. A positive number representing how much to payout.
Transfer mode. Must be one of: IMPS, NEFT, RTGS, or UPI.
The name of the beneficiary receiving the payout.
Required depending on the transfer mode. Provide accountNumber and ifscCode for IMPS/NEFT/RTGS, or vpa for UPI.
The phone number of the beneficiary. Useful for tracking and notifications.
The email address of the beneficiary.
The name of the beneficiary's bank.
A custom reference ID provided by you to track this payout in your system.
Customers
Customer objects allow you to perform recurring charges, and to track multiple charges, that are associated with the same customer.
Create a Customer
Creates a new customer object. You can optionally pass in an email, name, phone, and description.
-u sk_test_4eC39HqLyjWDarjtT1zdp7dc: \
-d email="jenny.rosen@example.com" \
-d name="Jenny Rosen" \
-d description="My First Test Customer"
Parameters
Customer's email address. It's displayed in the Dashboard and can be a useful for searching and tracking. This may be up to 512 characters.
Customer's full name or business name. This takes up to 256 characters.
Customer's phone number.