UNPKG

@lomi./sdk

Version:
652 lines (651 loc) 21.3 kB
import type { CheckoutSession } from '../models/CheckoutSession'; import type { ConnectedProvider } from '../models/ConnectedProvider'; import type { CreateCheckoutSession } from '../models/CreateCheckoutSession'; import type { CreateCustomer } from '../models/CreateCustomer'; import type { CreatePaymentLink } from '../models/CreatePaymentLink'; import type { CreateProduct } from '../models/CreateProduct'; import type { CreateRefund } from '../models/CreateRefund'; import type { CreateSubscriptionPlan } from '../models/CreateSubscriptionPlan'; import type { CreateWebhook } from '../models/CreateWebhook'; import type { CurrencyCode } from '../models/CurrencyCode'; import type { Customer } from '../models/Customer'; import type { Merchant } from '../models/Merchant'; import type { MerchantAccount } from '../models/MerchantAccount'; import type { PaymentLink } from '../models/PaymentLink'; import type { PaymentLinkType } from '../models/PaymentLinkType'; import type { Product } from '../models/Product'; import type { Provider } from '../models/Provider'; import type { ProviderCode } from '../models/ProviderCode'; import type { Refund } from '../models/Refund'; import type { Subscription } from '../models/Subscription'; import type { SubscriptionPlan } from '../models/SubscriptionPlan'; import type { Transaction } from '../models/Transaction'; import type { Webhook } from '../models/Webhook'; import type { WebhookEvent } from '../models/WebhookEvent'; import type { CancelablePromise } from '../core/CancelablePromise'; export declare class DefaultService { /** * Ping the API * @returns any Successful response * @throws ApiError */ static getPing(): CancelablePromise<{ message?: string; }>; /** * Get merchant details * @returns Merchant OK * @throws ApiError */ static getMerchants({ merchantId, }: { merchantId: string; }): CancelablePromise<Merchant>; /** * List connected payment providers for a merchant * @returns ConnectedProvider OK * @throws ApiError */ static merchantProviders({ merchantId, }: { merchantId: string; }): CancelablePromise<Array<ConnectedProvider>>; /** * Create a new product * @returns Product Created * @throws ApiError */ static postProducts({ requestBody, }: { requestBody?: CreateProduct; }): CancelablePromise<Product>; /** * List products for a merchant * @returns Product OK * @throws ApiError */ static getProducts({ merchantId, }: { merchantId: string; }): CancelablePromise<Array<Product>>; /** * Get product details * Get details of a specific product * @returns Product Product details retrieved successfully * @throws ApiError */ static getProduct({ productId, }: { productId: string; }): CancelablePromise<Product>; /** * Update product status * Update only the active status of a product. Core details (name, price, etc.) cannot be changed after creation. * @returns any Product status updated successfully * @throws ApiError */ static updateProductStatus({ productId, requestBody, }: { productId: string; requestBody: { is_active: boolean; }; }): CancelablePromise<any>; /** * Delete product * Delete a product * @returns void * @throws ApiError */ static deleteProduct({ productId, }: { productId: string; }): CancelablePromise<void>; /** * Create a subscription plan * @returns SubscriptionPlan Created * @throws ApiError */ static postSubscriptions({ requestBody, }: { requestBody?: CreateSubscriptionPlan; }): CancelablePromise<SubscriptionPlan>; /** * List subscription plans for a merchant * @returns SubscriptionPlan OK * @throws ApiError */ static getSubscriptions({ merchantId, limit, offset, }: { /** * The ID of the merchant whose plans to list. */ merchantId: string; /** * Maximum number of items to return. */ limit?: number; /** * Number of items to skip before starting to collect the result set. */ offset?: number; }): CancelablePromise<Array<SubscriptionPlan>>; /** * Create a subscription plan for a merchant * @returns SubscriptionPlan Created * @throws ApiError */ static postMerchantsSubscriptions({ merchantId, requestBody, }: { /** * The ID of the merchant for whom to create the plan. */ merchantId: string; requestBody?: CreateSubscriptionPlan; }): CancelablePromise<SubscriptionPlan>; /** * List subscription plans for a merchant * @returns SubscriptionPlan OK * @throws ApiError */ static getMerchantsSubscriptions({ merchantId, limit, offset, }: { /** * The ID of the merchant whose plans to list. */ merchantId: string; limit?: any; offset?: any; }): CancelablePromise<Array<SubscriptionPlan>>; /** * Get subscription plan details for a merchant * Get details of a specific subscription plan belonging to a merchant * @returns SubscriptionPlan Subscription plan details retrieved successfully * @throws ApiError */ static getSubscriptionPlan({ merchantId, planId, }: { /** * The ID of the merchant. */ merchantId: string; /** * The ID of the subscription plan. */ planId: string; }): CancelablePromise<SubscriptionPlan>; /** * Update subscription plan * Update specific fields (is_active, metadata) of a subscription plan. Core details are immutable via API. * @returns SubscriptionPlan Subscription plan updated successfully * @throws ApiError */ static updateSubscriptionPlan({ merchantId, planId, requestBody, }: { /** * The ID of the merchant. */ merchantId: string; /** * The ID of the subscription plan. */ planId: string; requestBody: { is_active?: boolean; metadata?: Record<string, any>; }; }): CancelablePromise<SubscriptionPlan>; /** * Delete subscription plan * Delete a subscription plan belonging to a merchant * @returns void * @throws ApiError */ static deleteSubscriptionPlan({ merchantId, planId, }: { /** * The ID of the merchant. */ merchantId: string; /** * The ID of the subscription plan. */ planId: string; }): CancelablePromise<void>; /** * List transactions for a merchant * @returns Transaction OK * @throws ApiError */ static transactionsList({ merchantId, }: { merchantId: string; }): CancelablePromise<Array<Transaction>>; /** * List available payment providers * @returns Provider OK * @throws ApiError */ static providers(): CancelablePromise<Array<Provider>>; /** * Create a refund * Initiate a refund for a transaction * @returns Refund Refund created successfully * @throws ApiError */ static createRefund({ requestBody, }: { requestBody: CreateRefund; }): CancelablePromise<Refund>; /** * Get refund details * Get details of a specific refund * @returns Refund Refund details retrieved successfully * @throws ApiError */ static getRefund({ refundId, }: { refundId: string; }): CancelablePromise<Refund>; /** * Update refund status * Update the status of a refund * @returns Refund Refund updated successfully * @throws ApiError */ static updateRefund({ refundId, requestBody, }: { refundId: string; requestBody: { status: 'completed' | 'failed'; metadata?: Record<string, any>; }; }): CancelablePromise<Refund>; /** * Create a customer * Create a new customer for a merchant * @returns Customer Customer created successfully * @throws ApiError */ static createCustomer({ requestBody, }: { requestBody: CreateCustomer; }): CancelablePromise<Customer>; /** * List customers * List all customers for a merchant * @returns Customer List of customers * @throws ApiError */ static listCustomers({ merchantId, email, phoneNumber, }: { merchantId: string; email?: string; phoneNumber?: string; }): CancelablePromise<Array<Customer>>; /** * Get customer details * Get details of a specific customer * @returns Customer Customer details retrieved successfully * @throws ApiError */ static getCustomer({ customerId, }: { customerId: string; }): CancelablePromise<Customer>; /** * Update customer * Update customer details * @returns Customer Customer updated successfully * @throws ApiError */ static updateCustomer({ customerId, requestBody, }: { customerId: string; requestBody: { email?: string; phone_number?: string; first_name?: string; last_name?: string; address?: { street?: string; city?: string; state?: string; postal_code?: string; country?: string; }; metadata?: Record<string, any>; }; }): CancelablePromise<Customer>; /** * Delete customer * Delete a customer * @returns void * @throws ApiError */ static deleteCustomer({ customerId, }: { customerId: string; }): CancelablePromise<void>; /** * Create a payment link * Create a new payment link for collecting payments * @returns PaymentLink Payment link created successfully * @throws ApiError */ static createPaymentLink({ requestBody, }: { requestBody: CreatePaymentLink; }): CancelablePromise<PaymentLink>; /** * List payment links * List all payment links for a merchant * @returns PaymentLink List of payment links * @throws ApiError */ static listPaymentLinks({ merchantId, linkType, currencyCode, isActive, }: { merchantId: string; linkType?: PaymentLinkType; currencyCode?: CurrencyCode; isActive?: boolean; }): CancelablePromise<Array<PaymentLink>>; /** * Get payment link details * Get details of a specific payment link * @returns PaymentLink Payment link details retrieved successfully * @throws ApiError */ static getPaymentLink({ linkId, }: { linkId: string; }): CancelablePromise<PaymentLink>; /** * Update payment link * Update configurable details of a payment link. * **Important:** Core link details (title, description, price/product/plan, currency, quantity settings) are fixed after creation and cannot be changed via the API. To modify these, create a new link. * * @returns PaymentLink Payment link updated successfully * @throws ApiError */ static updatePaymentLink({ linkId, requestBody, }: { linkId: string; requestBody: { /** * Set to null to remove expiration */ expires_at?: string | null; success_url?: string; cancel_url?: string; /** * Update the list of allowed payment providers */ allowed_providers?: Array<ProviderCode>; /** * Enable or disable coupon code usage for this link */ allow_coupon_code?: boolean; metadata?: Record<string, any>; }; }): CancelablePromise<PaymentLink>; /** * Delete payment link * Delete a payment link * @returns void * @throws ApiError */ static deletePaymentLink({ linkId, }: { linkId: string; }): CancelablePromise<void>; /** * Register a new webhook endpoint * Create a new webhook endpoint for receiving event notifications * @returns Webhook Webhook endpoint created successfully * @throws ApiError */ static createWebhook({ requestBody, }: { requestBody: CreateWebhook; }): CancelablePromise<Webhook>; /** * List webhook endpoints * List all webhook endpoints for a merchant * @returns Webhook List of webhook endpoints * @throws ApiError */ static listWebhooks({ merchantId, organizationId, isActive, }: { merchantId: string; organizationId?: string; isActive?: boolean; }): CancelablePromise<Array<Webhook>>; /** * Get webhook details * Get details of a specific webhook endpoint * @returns Webhook Webhook details retrieved successfully * @throws ApiError */ static getWebhook({ webhookId, }: { webhookId: string; }): CancelablePromise<Webhook>; /** * Update webhook configuration * Update webhook endpoint configuration * @returns Webhook Webhook configuration updated successfully * @throws ApiError */ static updateWebhook({ webhookId, requestBody, }: { webhookId: string; requestBody: { organization_id?: string; url?: string; authorized_events?: Array<WebhookEvent>; is_active?: boolean; metadata?: Record<string, any>; }; }): CancelablePromise<Webhook>; /** * Delete webhook endpoint * Delete a webhook endpoint * @returns void * @throws ApiError */ static deleteWebhook({ webhookId, }: { webhookId: string; }): CancelablePromise<void>; /** * Create a checkout session * Create a new checkout session for collecting payments * @returns CheckoutSession Checkout session created successfully * @throws ApiError */ static createCheckoutSession({ requestBody, }: { requestBody: CreateCheckoutSession; }): CancelablePromise<CheckoutSession>; /** * List checkout sessions * List all checkout sessions for a merchant * @returns CheckoutSession List of checkout sessions * @throws ApiError */ static listCheckoutSessions({ merchantId, checkoutSessionId, status, }: { merchantId: string; checkoutSessionId?: string; status?: 'open' | 'completed' | 'expired'; }): CancelablePromise<Array<CheckoutSession>>; /** * Get a checkout session by ID * Get details of a specific checkout session * @returns CheckoutSession Checkout session details retrieved successfully * @throws ApiError */ static getCheckoutSession({ sessionId, }: { sessionId: string; }): CancelablePromise<CheckoutSession>; /** * Get transaction details * Get details of a specific transaction by its ID * @returns Transaction Transaction details retrieved successfully * @throws ApiError */ static getTransactionById({ transactionId, }: { transactionId: string; }): CancelablePromise<Transaction>; /** * Get merchant monthly recurring revenue * Retrieve current monthly recurring revenue * @returns any Monthly recurring revenue retrieved successfully * @throws ApiError */ static getMerchantMrr({ merchantId, }: { merchantId: string; }): CancelablePromise<{ merchant_id?: string; /** * Monthly Recurring Revenue */ mrr?: number; created_at?: string; updated_at?: string; }>; /** * Get merchant annual recurring revenue * Retrieve current annual recurring revenue * @returns any Annual recurring revenue retrieved successfully * @throws ApiError */ static getMerchantArr({ merchantId, }: { merchantId: string; }): CancelablePromise<{ merchant_id?: string; /** * Annual Recurring Revenue */ arr?: number; created_at?: string; updated_at?: string; }>; /** * Get merchant account balance * Retrieve current account balance for a merchant * @returns any Account balance retrieved successfully * @throws ApiError */ static getMerchantBalance({ merchantId, currencyCode, }: { merchantId: string; /** * Filter balance by currency */ currencyCode?: CurrencyCode; }): CancelablePromise<Array<{ merchant_id?: string; currency_code?: CurrencyCode; balance?: number; created_at?: string; updated_at?: string; }>>; /** * List merchant accounts * Retrieve all accounts belonging to a merchant with their balances * @returns MerchantAccount List of merchant accounts retrieved successfully * @throws ApiError */ static listMerchantAccounts({ merchantId, currencyCode, }: { merchantId: string; /** * Filter accounts by currency */ currencyCode?: CurrencyCode; }): CancelablePromise<Array<MerchantAccount>>; /** * Get transaction summary for a merchant * Retrieve summary of transactions including total counts and amounts by status * @returns any Transaction summary retrieved successfully * @throws ApiError */ static getMerchantTransactionsSummary({ merchantId, startDate, endDate, currencyCode, }: { merchantId: string; /** * Start date for filtering transactions */ startDate?: string; /** * End date for filtering transactions */ endDate?: string; /** * Filter transactions by currency */ currencyCode?: CurrencyCode; }): CancelablePromise<{ total_count?: number; total_gross_amount?: number; total_fee_amount?: number; total_net_amount?: number; by_status?: { pending?: number; completed?: number; failed?: number; refunded?: number; expired?: number; }; by_payment_method?: Record<string, number>; }>; /** * List customer subscriptions * List all subscriptions for a merchant * @returns Subscription List of subscriptions * @throws ApiError */ static listCustomerSubscriptions({ merchantId, customerId, status, }: { merchantId: string; customerId?: string; status?: 'pending' | 'active' | 'paused' | 'cancelled' | 'expired' | 'past_due' | 'trial'; }): CancelablePromise<Array<Subscription>>; /** * Get subscription details * Get details of a specific subscription * @returns Subscription Subscription details retrieved successfully * @throws ApiError */ static getSubscription({ subscriptionId, merchantId, }: { subscriptionId: string; /** * The ID of the merchant owning the subscription. */ merchantId: string; }): CancelablePromise<Subscription>; /** * Update subscription * Update subscription details * @returns Subscription Subscription updated successfully * @throws ApiError */ static updateSubscription({ subscriptionId, merchantId, requestBody, }: { subscriptionId: string; /** * The ID of the merchant owning the subscription. */ merchantId: string; requestBody?: { status?: 'active' | 'paused' | 'cancelled'; end_date?: string; next_billing_date?: string; metadata?: Record<string, any>; }; }): CancelablePromise<Subscription>; /** * Cancel subscription * Cancel a subscription * @returns void * @throws ApiError */ static cancelSubscription({ subscriptionId, merchantId, }: { subscriptionId: string; /** * The ID of the merchant owning the subscription. */ merchantId: string; }): CancelablePromise<void>; /** * Regenerate webhook secret * Generate a new verification token for a webhook endpoint * @returns any Webhook secret regenerated successfully * @throws ApiError */ static regenerateWebhookSecret({ webhookId, }: { webhookId: string; }): CancelablePromise<{ webhook_id?: string; /** * New secret token used to verify webhook signatures. Format: whsec_* */ verification_token?: string; }>; /** * Send test webhook * Send a test event to a webhook endpoint to verify it's working correctly * @returns any Test webhook sent successfully * @throws ApiError */ static testWebhook({ webhookId, }: { webhookId: string; }): CancelablePromise<{ webhook_id?: string; success?: boolean; status_code?: number; response_body?: string; }>; }