// 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 Customers extends APIResource { /** * Get unique customers for a creator */ list( query: CustomerListParams | null | undefined = {}, options?: RequestOptions, ): APIPromise { return this._client.get('/customers', { query, ...options }); } /** * Charge a customer using a specific payment method */ charge( customerID: string, body: CustomerChargeParams | null | undefined = {}, options?: RequestOptions, ): APIPromise { return this._client.post(path`/customers/${customerID}/charge`, { body, ...options }); } /** * Get saved payment methods for a customer */ retrievePaymentMethods( customerID: string, options?: RequestOptions, ): APIPromise { return this._client.get(path`/customers/${customerID}/payment-methods`, options); } } export interface CustomerListResponse { data?: CustomerListResponse.Data; message?: string; status?: string; } export namespace CustomerListResponse { export interface Data { customers?: Array; pagination?: Data.Pagination; } export namespace Data { export interface Customer { id?: string; country_code?: string | null; email?: string; last_transaction_date?: string; name?: string; phone?: string | null; total_spent?: number; total_transactions?: number; } export interface Pagination { current_page?: number; has_more?: boolean; per_page?: number; total_items?: number; total_pages?: number; } } } export interface CustomerChargeResponse { data?: CustomerChargeResponse.Data; message?: string; status?: string; } export namespace CustomerChargeResponse { export interface Data { amount?: number; charge_id?: string; created_at?: string; status?: string; } } export interface CustomerRetrievePaymentMethodsResponse { data?: CustomerRetrievePaymentMethodsResponse.Data; message?: string; status?: string; } export namespace CustomerRetrievePaymentMethodsResponse { export interface Data { customer?: Data.Customer; payment_methods?: Array; } export namespace Data { export interface Customer { id?: string; email?: string; name?: string; } export interface PaymentMethod { id?: string; brand?: string | null; exp_month?: number | null; exp_year?: number | null; is_default?: boolean | null; last4?: string | null; type?: string; } } } export interface CustomerListParams { /** * Page number for pagination */ page?: number; /** * Number of items per page */ per_page?: number; /** * Search term to filter customers by email, name, or phone */ search?: string; } export interface CustomerChargeParams { amount_cents?: number; description?: string; metadata?: { [key: string]: unknown }; payment_method_id?: string; } export declare namespace Customers { export { type CustomerListResponse as CustomerListResponse, type CustomerChargeResponse as CustomerChargeResponse, type CustomerRetrievePaymentMethodsResponse as CustomerRetrievePaymentMethodsResponse, type CustomerListParams as CustomerListParams, type CustomerChargeParams as CustomerChargeParams, }; }