celeriz
v0.4.0
Published
Complete SDK for Celeriz Onramp/Offramp API with wallet integration and white-label support
Maintainers
Readme
Celeriz SDK
SDK for integrating with the Celeriz Onramp/Offramp API.
Installation
npm install celerizInitialization
// JavaScript
const { CelerizSDK } = require('celeriz');
const sdk = new CelerizSDK({ apiKey: 'YOUR_API_KEY' });// TypeScript
import { CelerizSDK } from 'celeriz';
const sdk = new CelerizSDK({ apiKey: 'YOUR_API_KEY' });apiKey(string, required): Your Celeriz API key (use thesk-...key provided).baseUrl(string, optional): Override the default API base URL if needed.
Methods
Onramp
getOnrampQuote(params)
Get a quote for fiat-to-crypto conversion.
Parameters:
fromCurrency(string): Base currency (e.g., 'INR')toCurrency(string): Crypto currency (e.g., 'USDT')fromAmount(string): Fiat amountchain(string): Network (e.g., 'bep20')paymentMethodType(string): Payment method (e.g., 'UPI')
Example:
const quote = await sdk.getOnrampQuote({
fromCurrency: 'INR',
toCurrency: 'USDT',
fromAmount: '1000',
chain: 'bep20',
paymentMethodType: 'UPI',
});createOnrampTransaction(params)
Create an onramp transaction.
Parameters:
fromCurrency,toCurrency,chain,paymentMethodType,depositAddress,customerId,fromAmount,toAmount,rate(all strings)
Example:
const tx = await sdk.createOnrampTransaction({
fromCurrency: 'INR',
toCurrency: 'USDT',
chain: 'bep20',
paymentMethodType: 'UPI',
depositAddress: '0x123...',
customerId: 'cust_123',
fromAmount: '1000',
toAmount: '12.5',
rate: '80.0',
});Offramp
getOfframpQuote(params)
Get a quote for crypto-to-fiat conversion.
Parameters:
chain,fromCurrency,toCurrency,fromAmount(all strings)
Example:
const quote = await sdk.getOfframpQuote({
chain: 'bep20',
fromCurrency: 'USDT',
toCurrency: 'INR',
fromAmount: '10',
});createOfframpTransaction(params)
Create an offramp transaction.
Parameters:
fromCurrency,toCurrency,chain,fiatAccountId,customerId,fromAmount,toAmount,rate(all strings)
Example:
const tx = await sdk.createOfframpTransaction({
fromCurrency: 'USDT',
toCurrency: 'INR',
chain: 'bep20',
fiatAccountId: 'acc_123',
customerId: 'cust_123',
fromAmount: '10',
toAmount: '800',
rate: '80.0',
});KYC
getKycUrl(params)
Get a KYC URL for user verification.
getKycRequirements(params)
Get KYC requirements for a specific country/customer.
submitKycDetails(params)
Submit KYC details for verification.
submitKycFiles(params)
Submit KYC files for verification.
getKycStatus(params)
Get KYC verification status.
All KYC methods accept an object with the required fields as per your API docs.
KYB
getKybRequirements(country)
Get KYB requirements for a country.
Parameters:
country(string): Country code (e.g., 'IN')
submitKybDetails(params)
Submit KYB details (object as per API docs).
submitKybDocuments(formData)
Submit KYB documents (use a FormData object for file uploads).
Merchant
setMerchantWebhookUrl({ webhookUrl })
Set the webhook URL for your merchant account.
Parameters:
webhookUrl(string): The webhook URL to set
Example:
await sdk.setMerchantWebhookUrl({ webhookUrl: 'https://yourdomain.com/webhook' });Error Handling
All methods throw if the API returns an error. Use try/catch to handle errors:
try {
const quote = await sdk.getOnrampQuote({ ... });
} catch (err) {
console.error('API error:', err.response?.data || err.message);
}Troubleshooting
- 401 Unauthorized: Ensure your API key is correct and passed as
x-api-key. - Network errors: Check your internet connection and base URL.
- Parameter errors: Double-check required fields for each method.
Contributing
Pull requests and issues are welcome! Please open an issue for bugs or feature requests.
License
MIT
