takefy-cryptomus
Version:
TypeScript SDK for the Cryptomus payment system API
68 lines (67 loc) • 2.18 kB
TypeScript
import { OtherService } from "./services/other";
import { PaymentsService } from "./services/payments";
import { PayoutsService } from "./services/payouts";
import type { CryptomusConfig } from "./types/config";
/**
* Main client class for interacting with the Cryptomus API.
* Provides access to payments, payouts, and other services through a unified interface.
*
* @class
* @example
* ```typescript
* const client = new CryptomusClient({
* merchantId: "your-merchant-id",
* paymentKey: "your-payment-key",
* payoutKey: "your-payout-key"
* });
*
* // Create a payment
* const payment = await client.payments.create({
* amount: "100",
* currency: "USD",
* order_id: "test-123"
* });
*
* // Create a payout
* const payout = await client.payouts.create({
* amount: "50",
* currency: "USDT",
* network: "TRX",
* address: "wallet-address"
* });
*
* // Get exchange rates
* const rates = await client.other.getExchangeRatesForCurrency("USDT");
* ```
*/
export declare class CryptomusClient {
/** Base URL for the Cryptomus API */
private readonly baseUrl;
/**
* Service for handling payment operations.
* Includes methods for creating payments, managing wallets, and handling discounts.
*/
readonly payments: PaymentsService;
/**
* Service for handling payout operations.
* Includes methods for creating payouts and transferring funds.
*/
readonly payouts: PayoutsService;
/**
* Service for other utility operations.
* Currently includes methods for retrieving exchange rates.
*/
readonly other: OtherService;
/**
* Creates a new instance of the CryptomusClient.
*
* @param {CryptomusConfig} config - Configuration object containing API credentials.
* @param {string} config.merchantId - Your Cryptomus merchant ID.
* @param {string} config.paymentKey - Your API key for payment operations.
* @param {string} config.payoutKey - Your API key for payout operations.
*
* @throws {Error} If required configuration parameters are missing.
*/
constructor(config: CryptomusConfig);
}
export * from "./types";