upay-pg-by-kayesfahim
Version:
A Node.js SDK for interacting with the Upay payment system.
42 lines (36 loc) • 1.19 kB
TypeScript
declare module 'upay-pg-by-kayesfahim' {
export interface AuthResponse {
token: string;
expires_in: number;
}
export interface PaymentDetails {
amount: number;
currency: string;
merchant_id: string;
customer_info: {
name: string;
email: string;
};
}
export interface PaymentResponse {
transaction_id: string;
status: string;
message: string;
}
export default class Upay {
constructor(baseUrl?: string);
/**
* Authenticate with the Upay API using your merchant credentials.
* @param merchantId - Your merchant ID.
* @param merchantKey - Your merchant key.
* @returns A promise that resolves to the authentication response.
*/
auth(merchantId: string, merchantKey: string): Promise<AuthResponse>;
/**
* Initiates a payment request with the given details.
* @param paymentDetails - The details of the payment to be initiated.
* @returns A promise that resolves to the payment response.
*/
initiatePayment(paymentDetails: PaymentDetails): Promise<PaymentResponse>;
}
}