cloudflare
Version:
The official TypeScript library for the Cloudflare API
93 lines • 3.18 kB
TypeScript
import { APIResource } from "../../../../core/resource.js";
import * as ConfigAPI from "./config.js";
import { BaseConfig, Config, ConfigCreateParams, ConfigCreateResponse, ConfigDeleteParams, ConfigDeleteResponse, ConfigGetParams, ConfigGetResponse } from "./config.js";
import { APIPromise } from "../../../../core/api-promise.js";
import { RequestOptions } from "../../../../internal/request-options.js";
export declare class BaseTopup extends APIResource {
static readonly _key: readonly ['aiGateway', 'billing', 'topup'];
/**
* Create a credit top-up for the given account, charged to the account's default
* payment method.
*
* @example
* ```ts
* const topup = await client.aiGateway.billing.topup.create({
* account_id: 'account_id',
* amount: 5000,
* });
* ```
*/
create(params: TopupCreateParams, options?: RequestOptions): APIPromise<TopupCreateResponse>;
/**
* Get the payment processing status of a top-up by its invoice ID.
*
* @example
* ```ts
* const response =
* await client.aiGateway.billing.topup.status({
* account_id: 'account_id',
* payment_intent_id: 'in_1abc',
* });
* ```
*/
status(params: TopupStatusParams, options?: RequestOptions): APIPromise<TopupStatusResponse>;
}
export declare class Topup extends BaseTopup {
config: ConfigAPI.Config;
}
export interface TopupCreateResponse {
/**
* Stripe PaymentIntent client secret.
*/
client_secret: string | null;
/**
* Whether the user was already onboarded.
*/
onboarding: boolean;
/**
* Stripe invoice ID.
*/
payment_intent_id: string;
/**
* Card brand (visa, mastercard, etc.).
*/
brand?: string;
/**
* Last 4 digits of card.
*/
last4?: string;
}
export interface TopupStatusResponse {
payment_intent_id: string;
status: 'completed' | 'pending';
}
export interface TopupCreateParams {
/**
* Path param: Cloudflare account ID.
*/
account_id: string;
/**
* Body param: Top-up amount in cents (min 1000).
*/
amount: number;
/**
* Body param: Stripe PaymentMethod to charge instead of the customer's default
* payment method.
*/
payment_method_id?: string;
}
export interface TopupStatusParams {
/**
* Path param: Cloudflare account ID.
*/
account_id: string;
/**
* Body param: Stripe invoice ID to check status for.
*/
payment_intent_id: string;
}
export declare namespace Topup {
export { type TopupCreateResponse as TopupCreateResponse, type TopupStatusResponse as TopupStatusResponse, type TopupCreateParams as TopupCreateParams, type TopupStatusParams as TopupStatusParams, };
export { Config as Config, BaseConfig as BaseConfig, type ConfigCreateResponse as ConfigCreateResponse, type ConfigDeleteResponse as ConfigDeleteResponse, type ConfigGetResponse as ConfigGetResponse, type ConfigCreateParams as ConfigCreateParams, type ConfigDeleteParams as ConfigDeleteParams, type ConfigGetParams as ConfigGetParams, };
}
//# sourceMappingURL=topup.d.ts.map