EienONE Quickstart

Learn how to accept payments and send payouts using the EienONE API. Setup takes less than 5 minutes.

1. Install Library

npm install @EienONE/node

2. Initialize SDK

import { EienONE } from '@EienONE/node';

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'
});
Security

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.

curl https://api.eienone.in/v1/charges \
  -u sk_test_4eC39HqLyjWDarjtT1zdp7dc:
Events

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.

Browser

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.

Troubleshooting

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.

CodeTypeDescription
400 - Bad Requestinvalid_request_errorThe request was unacceptable, often due to missing a required parameter.
401 - Unauthorizedauthentication_errorNo valid API key provided.
402 - Request Failedcard_errorThe parameters were valid but the request failed.
429 - Too Many Requestsrate_limit_errorToo many requests hit the API too quickly. We recommend an exponential backoff of your requests.
Core API

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.

POST/v1/payouts
curl https://api.eienone.in/v1/payouts \
  -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

amountREQUIRED

Amount intended to be sent. A positive number representing how much to payout.

modeREQUIRED

Transfer mode. Must be one of: IMPS, NEFT, RTGS, or UPI.

beneficiaryNameREQUIRED

The name of the beneficiary receiving the payout.

accountNumber & ifscCode / vpaREQUIRED

Required depending on the transfer mode. Provide accountNumber and ifscCode for IMPS/NEFT/RTGS, or vpa for UPI.

beneficiaryPhoneOPTIONAL

The phone number of the beneficiary. Useful for tracking and notifications.

beneficiaryEmailOPTIONAL

The email address of the beneficiary.

bankNameOPTIONAL

The name of the beneficiary's bank.

referenceIdOPTIONAL

A custom reference ID provided by you to track this payout in your system.

Core API

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.

POST/v1/customers
curl https://api.eienone.in/v1/customers \
  -u sk_test_4eC39HqLyjWDarjtT1zdp7dc: \
  -d email="jenny.rosen@example.com" \
  -d name="Jenny Rosen" \
  -d description="My First Test Customer"

Parameters

emailOPTIONAL

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.

nameOPTIONAL

Customer's full name or business name. This takes up to 256 characters.

phoneOPTIONAL

Customer's phone number.