thawani-nodejs
Version:
Node.js library for Thawani Payment Gateway
34 lines (33 loc) • 1.11 kB
TypeScript
import { BaseResource } from './base';
export interface PaymentIntentParams {
payment_method_id?: string;
amount: number;
client_reference_id: string;
return_url: string;
metadata: Record<string, any>;
}
export interface PaymentIntent {
id: string;
client_reference_id: string;
amount: number;
currency: string;
payment_method?: string;
next_action?: {
url: string;
return_url: string;
};
status: 'requires_payment_method' | 'requires_action' | 'requires_confirmation' | 'succeeded' | 'cancelled';
metadata: Record<string, any>;
created_at: string;
expire_at: string;
}
export declare class PaymentIntents extends BaseResource {
create(params: PaymentIntentParams): Promise<PaymentIntent>;
retrieve(paymentIntentId: string): Promise<PaymentIntent>;
confirm(paymentIntentId: string, data?: {
payment_method_id?: string;
amount?: number;
}): Promise<PaymentIntent>;
cancel(paymentIntentId: string): Promise<PaymentIntent>;
list(limit?: number, skip?: number): Promise<PaymentIntent[]>;
}