@lexriver/yandex-pay
Version:
A TypeScript client for Yandex Pay API to integrate payment processing in your Node.js applications
25 lines (24 loc) • 946 B
JavaScript
import { OperationService } from './services/OperationService.js';
import { OrderService } from './services/OrderService.js';
import { SubscriptionService } from './services/SubscriptionService.js';
/**
* YandexPayAPI client for making requests to the Yandex Pay API
*/
export class YandexPayAPI {
/**
* Creates a new YandexPayAPI instance
*
* @param config Configuration for the API client
*/
constructor(config) {
this.apiKey = config.apiKey;
this.isSandbox = config.isSandbox || false;
this.baseUrl = this.isSandbox
? 'https://sandbox.pay.yandex.ru/api/merchant'
: 'https://pay.yandex.ru/api/merchant';
// Initialize services
this.orders = new OrderService(this.baseUrl, this.apiKey);
this.operations = new OperationService(this.baseUrl, this.apiKey);
this.subscriptions = new SubscriptionService(this.baseUrl, this.apiKey);
}
}