UNPKG

cloudflare

Version:

The official TypeScript library for the Cloudflare API

666 lines • 15.9 kB
import { APIResource } from "../../core/resource.mjs"; import { APIPromise } from "../../core/api-promise.mjs"; import { PagePromise, V4PagePaginationArray, type V4PagePaginationArrayParams } from "../../core/pagination.mjs"; import { RequestOptions } from "../../internal/request-options.mjs"; export declare class BasePaymentMethods extends APIResource { static readonly _key: readonly ['accounts', 'paymentMethods']; /** * Creates a new payment method for an account. * * @example * ```ts * const paymentMethod = * await client.accounts.paymentMethods.create({ * account_id: '023e105f4ecef8ad9ca31a8372d0c353', * }); * ``` */ create(params: PaymentMethodCreateParams, options?: RequestOptions): APIPromise<PaymentMethodCreateResponse>; /** * Updates a payment method for an account. * * @example * ```ts * const paymentMethod = * await client.accounts.paymentMethods.update( * '023e105f4ecef8ad9ca31a8372d0c353', * { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, * ); * ``` */ update(paymentMethodID: string, params: PaymentMethodUpdateParams, options?: RequestOptions): APIPromise<PaymentMethodUpdateResponse>; /** * Lists all payment methods for an account. * * @example * ```ts * // Automatically fetches more pages as needed. * for await (const paymentMethodListResponse of client.accounts.paymentMethods.list( * { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, * )) { * // ... * } * ``` */ list(params: PaymentMethodListParams, options?: RequestOptions): PagePromise<PaymentMethodListResponsesV4PagePaginationArray, PaymentMethodListResponse>; /** * Deletes a payment method from an account. * * @example * ```ts * const paymentMethod = * await client.accounts.paymentMethods.delete( * '023e105f4ecef8ad9ca31a8372d0c353', * { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, * ); * ``` */ delete(paymentMethodID: string, params: PaymentMethodDeleteParams, options?: RequestOptions): APIPromise<PaymentMethodDeleteResponse>; /** * Gets a specific payment method for an account. * * @example * ```ts * const paymentMethod = * await client.accounts.paymentMethods.get( * '023e105f4ecef8ad9ca31a8372d0c353', * { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, * ); * ``` */ get(paymentMethodID: string, params: PaymentMethodGetParams, options?: RequestOptions): APIPromise<PaymentMethodGetResponse>; /** * Sets a payment method as the default for an account. * * @example * ```ts * const response = * await client.accounts.paymentMethods.setAsDefault( * '023e105f4ecef8ad9ca31a8372d0c353', * { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, * ); * ``` */ setAsDefault(paymentMethodID: string, params: PaymentMethodSetAsDefaultParams, options?: RequestOptions): APIPromise<PaymentMethodSetAsDefaultResponse>; } export declare class PaymentMethods extends BasePaymentMethods { } export type PaymentMethodListResponsesV4PagePaginationArray = V4PagePaginationArray<PaymentMethodListResponse>; export interface PaymentMethodCreateResponse { /** * Payment method identifier. */ id?: string; /** * Billing address line 1. */ address?: string; /** * Billing address line 2. */ address2?: string; /** * Bank account type. */ bank_account_type?: string; /** * Bank code. */ bank_code?: string; /** * Bank country. */ bank_country?: string; /** * Bank name for bank-based payment methods. */ bank_name?: string; /** * Bank routing number. */ bank_routing_number?: string; /** * Cash App cash tag. */ cashapp_cash_tag?: string; /** * Billing city. */ city?: string; /** * Billing country. */ country?: string; /** * Whether this is the default payment method. */ default?: boolean; /** * Card expiration date. */ expiration_date?: string; /** * Billing first name. */ first_name?: string; /** * Last four digits of the card number. */ last_four?: string; /** * Billing last name. */ last_name?: string; /** * A nickname for the payment method. */ nick_name?: string; /** * Email associated with the payment account. */ payment_account_email?: string; /** * Payment email address. */ payment_email?: string; /** * Billing state. */ state?: string; /** * The payment method type. */ type?: 'CREDIT_CARD' | 'PAYPAL' | 'CASHAPP' | 'SEPA_DEBIT' | 'LINK' | 'ACH_DIRECT_DEBIT'; /** * Billing zip code. */ zipcode?: string; } export interface PaymentMethodUpdateResponse { /** * Payment method identifier. */ id?: string; /** * Billing address line 1. */ address?: string; /** * Billing address line 2. */ address2?: string; /** * Bank account type. */ bank_account_type?: string; /** * Bank code. */ bank_code?: string; /** * Bank country. */ bank_country?: string; /** * Bank name for bank-based payment methods. */ bank_name?: string; /** * Bank routing number. */ bank_routing_number?: string; /** * Cash App cash tag. */ cashapp_cash_tag?: string; /** * Billing city. */ city?: string; /** * Billing country. */ country?: string; /** * Whether this is the default payment method. */ default?: boolean; /** * Card expiration date. */ expiration_date?: string; /** * Billing first name. */ first_name?: string; /** * Last four digits of the card number. */ last_four?: string; /** * Billing last name. */ last_name?: string; /** * A nickname for the payment method. */ nick_name?: string; /** * Email associated with the payment account. */ payment_account_email?: string; /** * Payment email address. */ payment_email?: string; /** * Billing state. */ state?: string; /** * The payment method type. */ type?: 'CREDIT_CARD' | 'PAYPAL' | 'CASHAPP' | 'SEPA_DEBIT' | 'LINK' | 'ACH_DIRECT_DEBIT'; /** * Billing zip code. */ zipcode?: string; } export interface PaymentMethodListResponse { /** * Payment method identifier. */ id?: string; /** * Billing address line 1. */ address?: string; /** * Billing address line 2. */ address2?: string; /** * Bank account type. */ bank_account_type?: string; /** * Bank code. */ bank_code?: string; /** * Bank country. */ bank_country?: string; /** * Bank name for bank-based payment methods. */ bank_name?: string; /** * Bank routing number. */ bank_routing_number?: string; /** * Cash App cash tag. */ cashapp_cash_tag?: string; /** * Billing city. */ city?: string; /** * Billing country. */ country?: string; /** * Whether this is the default payment method. */ default?: boolean; /** * Card expiration date. */ expiration_date?: string; /** * Billing first name. */ first_name?: string; /** * Last four digits of the card number. */ last_four?: string; /** * Billing last name. */ last_name?: string; /** * A nickname for the payment method. */ nick_name?: string; /** * Email associated with the payment account. */ payment_account_email?: string; /** * Payment email address. */ payment_email?: string; /** * Billing state. */ state?: string; /** * The payment method type. */ type?: 'CREDIT_CARD' | 'PAYPAL' | 'CASHAPP' | 'SEPA_DEBIT' | 'LINK' | 'ACH_DIRECT_DEBIT'; /** * Billing zip code. */ zipcode?: string; } export type PaymentMethodDeleteResponse = unknown | string | null; export interface PaymentMethodGetResponse { /** * Payment method identifier. */ id?: string; /** * Billing address line 1. */ address?: string; /** * Billing address line 2. */ address2?: string; /** * Bank account type. */ bank_account_type?: string; /** * Bank code. */ bank_code?: string; /** * Bank country. */ bank_country?: string; /** * Bank name for bank-based payment methods. */ bank_name?: string; /** * Bank routing number. */ bank_routing_number?: string; /** * Cash App cash tag. */ cashapp_cash_tag?: string; /** * Billing city. */ city?: string; /** * Billing country. */ country?: string; /** * Whether this is the default payment method. */ default?: boolean; /** * Card expiration date. */ expiration_date?: string; /** * Billing first name. */ first_name?: string; /** * Last four digits of the card number. */ last_four?: string; /** * Billing last name. */ last_name?: string; /** * A nickname for the payment method. */ nick_name?: string; /** * Email associated with the payment account. */ payment_account_email?: string; /** * Payment email address. */ payment_email?: string; /** * Billing state. */ state?: string; /** * The payment method type. */ type?: 'CREDIT_CARD' | 'PAYPAL' | 'CASHAPP' | 'SEPA_DEBIT' | 'LINK' | 'ACH_DIRECT_DEBIT'; /** * Billing zip code. */ zipcode?: string; } export type PaymentMethodSetAsDefaultResponse = unknown | string | null; export interface PaymentMethodCreateParams { /** * Path param: Identifier */ account_id: string; /** * Body param: Billing address line 1. */ address?: string; /** * Body param: Billing address line 2. */ address2?: string; /** * Body param: Bank account type. */ bank_account_type?: string; /** * Body param: Bank code. */ bank_code?: string; /** * Body param: Bank country. */ bank_country?: string; /** * Body param: Bank name for bank-based payment methods. */ bank_name?: string; /** * Body param: Bank routing number. */ bank_routing_number?: string; /** * Body param: Cash App cash tag. */ cashapp_cash_tag?: string; /** * Body param: Billing city. */ city?: string; /** * Body param: Billing country. */ country?: string; /** * Body param: Whether this is the default payment method. */ default?: boolean; /** * Body param: Device data for fraud prevention. */ device_data?: string; /** * Body param: Billing first name. */ first_name?: string; /** * Body param: Billing last name. */ last_name?: string; /** * Body param: A nickname for the payment method. */ nick_name?: string; /** * Body param: Email associated with the payment account. */ payment_account_email?: string; /** * Body param: Payment email address. */ payment_email?: string; /** * Body param: The payment gateway used. */ payment_gateway?: string; /** * Body param: Payment nonce for tokenized payments. */ payment_nonce?: string; /** * Body param: Billing state. */ state?: string; /** * Body param: The payment method type. */ type?: 'CREDIT_CARD' | 'PAYPAL' | 'CASHAPP' | 'SEPA_DEBIT' | 'LINK' | 'ACH_DIRECT_DEBIT'; /** * Body param: Billing zip code. */ zipcode?: string; } export interface PaymentMethodUpdateParams { /** * Path param: Identifier */ account_id: string; /** * Body param: Billing address line 1. */ address?: string; /** * Body param: Billing address line 2. */ address2?: string; /** * Body param: Bank account type. */ bank_account_type?: string; /** * Body param: Bank code. */ bank_code?: string; /** * Body param: Bank country. */ bank_country?: string; /** * Body param: Bank name for bank-based payment methods. */ bank_name?: string; /** * Body param: Bank routing number. */ bank_routing_number?: string; /** * Body param: Cash App cash tag. */ cashapp_cash_tag?: string; /** * Body param: Billing city. */ city?: string; /** * Body param: Billing country. */ country?: string; /** * Body param: Whether this is the default payment method. */ default?: boolean; /** * Body param: Device data for fraud prevention. */ device_data?: string; /** * Body param: Billing first name. */ first_name?: string; /** * Body param: Billing last name. */ last_name?: string; /** * Body param: A nickname for the payment method. */ nick_name?: string; /** * Body param: Email associated with the payment account. */ payment_account_email?: string; /** * Body param: Payment email address. */ payment_email?: string; /** * Body param: The payment gateway used. */ payment_gateway?: string; /** * Body param: Payment nonce for tokenized payments. */ payment_nonce?: string; /** * Body param: Billing state. */ state?: string; /** * Body param: The payment method type. */ type?: 'CREDIT_CARD' | 'PAYPAL' | 'CASHAPP' | 'SEPA_DEBIT' | 'LINK' | 'ACH_DIRECT_DEBIT'; /** * Body param: Billing zip code. */ zipcode?: string; } export interface PaymentMethodListParams extends V4PagePaginationArrayParams { /** * Path param: Identifier */ account_id: string; } export interface PaymentMethodDeleteParams { /** * Identifier */ account_id: string; } export interface PaymentMethodGetParams { /** * Identifier */ account_id: string; } export interface PaymentMethodSetAsDefaultParams { /** * Identifier */ account_id: string; } export declare namespace PaymentMethods { export { type PaymentMethodCreateResponse as PaymentMethodCreateResponse, type PaymentMethodUpdateResponse as PaymentMethodUpdateResponse, type PaymentMethodListResponse as PaymentMethodListResponse, type PaymentMethodDeleteResponse as PaymentMethodDeleteResponse, type PaymentMethodGetResponse as PaymentMethodGetResponse, type PaymentMethodSetAsDefaultResponse as PaymentMethodSetAsDefaultResponse, type PaymentMethodListResponsesV4PagePaginationArray as PaymentMethodListResponsesV4PagePaginationArray, type PaymentMethodCreateParams as PaymentMethodCreateParams, type PaymentMethodUpdateParams as PaymentMethodUpdateParams, type PaymentMethodListParams as PaymentMethodListParams, type PaymentMethodDeleteParams as PaymentMethodDeleteParams, type PaymentMethodGetParams as PaymentMethodGetParams, type PaymentMethodSetAsDefaultParams as PaymentMethodSetAsDefaultParams, }; } //# sourceMappingURL=payment-methods.d.mts.map