import { APIResource } from "../../core/resource.js"; import * as Shared from "../shared.js"; import { APIPromise } from "../../core/api-promise.js"; import { BodyCursorPage, type BodyCursorPageParams, PagePromise } from "../../core/pagination.js"; import { RequestOptions } from "../../internal/request-options.js"; export declare class Payments extends APIResource { /** * Fetch all payment attempts for the given invoice. * * @example * ```ts * // Automatically fetches more pages as needed. * for await (const payment of client.v1.payments.list({ * customer_id: '13117714-3f05-48e5-a6e9-a66093f13b4d', * invoice_id: '6162d87b-e5db-4a33-b7f2-76ce6ead4e85', * statuses: ['pending', 'requires_intervention'], * })) { * // ... * } * ``` */ list(body: PaymentListParams, options?: RequestOptions): PagePromise; /** * Trigger a new attempt by canceling any existing attempts for this invoice and * creating a new Payment. This will trigger another attempt to charge the * Customer's configured Payment Gateway. Payment can only be attempted if all of * the following are true: * * - The Metronome Invoice is finalized * - PLG Invoicing is configured for the Customer * - You cannot attempt payments for invoices that have already been `paid` or * `voided`. * * Attempting to payment on an ineligible Invoice or Customer will result in a * `400` response. * * @example * ```ts * const response = await client.v1.payments.attempt({ * customer_id: '13117714-3f05-48e5-a6e9-a66093f13b4d', * invoice_id: '6162d87b-e5db-4a33-b7f2-76ce6ead4e85', * }); * ``` */ attempt(body: PaymentAttemptParams, options?: RequestOptions): APIPromise; /** * Cancel an existing payment attempt for an invoice. * * @example * ```ts * const response = await client.v1.payments.cancel({ * customer_id: '13117714-3f05-48e5-a6e9-a66093f13b4d', * invoice_id: '6162d87b-e5db-4a33-b7f2-76ce6ead4e85', * }); * ``` */ cancel(body: PaymentCancelParams, options?: RequestOptions): APIPromise; } export type PaymentsBodyCursorPage = BodyCursorPage; export interface Payment { id: string; amount?: number; amount_paid?: number; contract_id?: string; created_at?: string; customer_id?: string; error_message?: string; fiat_credit_type?: Shared.CreditTypeData; invoice_id?: string; payment_gateway?: Payment.PaymentGateway; revenue_system_payments?: Array; status?: PaymentStatus; updated_at?: string; } export declare namespace Payment { interface PaymentGateway { stripe: PaymentGateway.Stripe; type: 'stripe'; } namespace PaymentGateway { interface Stripe { payment_intent_id: string; error?: Stripe.Error; payment_method_id?: string; } namespace Stripe { interface Error { code?: string; decline_code?: string; type?: string; } } } interface RevenueSystemPayment { revenue_system_provider: string; sync_status: string; /** * The error message from the revenue system, if available. */ error_message?: string; revenue_system_external_payment_id?: string; } } export type PaymentStatus = 'pending' | 'requires_intervention' | 'paid' | 'canceled'; export interface PaymentAttemptResponse { data: Payment; } export interface PaymentCancelResponse { data: Payment; } export interface PaymentListParams extends BodyCursorPageParams { customer_id: string; invoice_id: string; statuses?: Array; } export interface PaymentAttemptParams { customer_id: string; invoice_id: string; } export interface PaymentCancelParams { customer_id: string; invoice_id: string; } export declare namespace Payments { export { type Payment as Payment, type PaymentStatus as PaymentStatus, type PaymentAttemptResponse as PaymentAttemptResponse, type PaymentCancelResponse as PaymentCancelResponse, type PaymentsBodyCursorPage as PaymentsBodyCursorPage, type PaymentListParams as PaymentListParams, type PaymentAttemptParams as PaymentAttemptParams, type PaymentCancelParams as PaymentCancelParams, }; } //# sourceMappingURL=payments.d.ts.map