// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../../core/resource'; import { APIPromise } from '../../core/api-promise'; import { RequestOptions } from '../../internal/request-options'; import { path } from '../../internal/utils/path'; export class Transactions extends APIResource { /** * Get all transactions for a creator with product filter */ list( query: TransactionListParams | null | undefined = {}, options?: RequestOptions, ): APIPromise { return this._client.get('/checkout-sessions/transactions', { query, ...options }); } /** * Get transactions for a specific checkout session */ listForSession( checkoutSessionID: string, query: TransactionListForSessionParams | null | undefined = {}, options?: RequestOptions, ): APIPromise { return this._client.get(path`/checkout-sessions/${checkoutSessionID}/transactions`, { query, ...options, }); } /** * Refund a transaction */ refund( transactionID: string | number, body: TransactionRefundParams | null | undefined = {}, options?: RequestOptions, ): APIPromise { return this._client.post(path`/checkout-sessions/transactions/${transactionID}/refund`, { body, ...options, }); } } export interface TransactionListResponse { data?: TransactionListResponse.Data; message?: string; status?: string; } export namespace TransactionListResponse { export interface Data { pagination?: Data.Pagination; transactions?: Array; } export namespace Data { export interface Pagination { current_page?: number; has_more?: boolean; per_page?: number; total_items?: number; total_pages?: number; } export interface Transaction { id?: string; fan?: Transaction.Fan; service?: Transaction.Service; servicePayment?: Transaction.ServicePayment; subscriber?: unknown; } export namespace Transaction { export interface Fan { id?: string; country_code?: string; email?: string; name?: string; phone?: string; } export interface Service { id?: string; price?: number; title?: string; } export interface ServicePayment { id?: string; fund_release_on?: string; fund_released?: boolean; payment_type?: string; } } } } export interface TransactionListForSessionResponse { data?: TransactionListForSessionResponse.Data; message?: string; status?: string; } export namespace TransactionListForSessionResponse { export interface Data { pagination?: Data.Pagination; transactions?: Array; } export namespace Data { export interface Pagination { current_page?: number; has_more?: boolean; per_page?: number; total_items?: number; total_pages?: number; } export interface Transaction { id?: string; fan?: Transaction.Fan; service?: Transaction.Service; servicePayment?: Transaction.ServicePayment; subscriber?: unknown; } export namespace Transaction { export interface Fan { id?: string; country_code?: string; email?: string; name?: string; phone?: string; } export interface Service { id?: string; price?: number; title?: string; } export interface ServicePayment { id?: string; fund_release_on?: string; fund_released?: boolean; payment_type?: string; } } } } export interface TransactionRefundResponse { data?: TransactionRefundResponse.Data; message?: string; request_id?: string; status?: string; } export namespace TransactionRefundResponse { export interface Data { creator_amount_deduction?: number; proportional_fee?: number; refund_amount?: number; refund_amount_cents?: number; refund_cost?: number; refund_id?: string; refund_type?: 'full' | 'partial'; transaction_id?: string; } } export interface TransactionListParams { /** * ID of the customer to get transactions for */ customer_id?: number | string; /** * Page number for pagination */ page?: number; /** * Number of items per page */ per_page?: number; /** * ID of the product to get transactions for */ product_id?: number | string; } export interface TransactionListForSessionParams { /** * Page number for pagination */ page?: number; /** * Number of items per page */ per_page?: number; } export interface TransactionRefundParams { /** * Amount in cents to refund */ amount_cents?: number; } export declare namespace Transactions { export { type TransactionListResponse as TransactionListResponse, type TransactionListForSessionResponse as TransactionListForSessionResponse, type TransactionRefundResponse as TransactionRefundResponse, type TransactionListParams as TransactionListParams, type TransactionListForSessionParams as TransactionListForSessionParams, type TransactionRefundParams as TransactionRefundParams, }; }