payment-gateway-frontend-lib
Version:
Template and quick-starter to create modern React libraries using Rollup.
20 lines (19 loc) • 1.09 kB
TypeScript
/**
* Opens the Omise credit card form by dynamically loading the Omise script if it is not already loaded.
* If the script is already present, it directly opens the credit card form.
*
* The function checks for the presence of a script element with the ID 'omise-script'.
* If the script is not found, it creates a new script element, sets its source to the Omise CDN,
* and appends it to the body of the document. Once the script is loaded, it calls the `onOpenOmiseCreditCard` function.
* If the script is already present, it directly calls the `onOpenOmiseCreditCard` function.
*/
export interface IPayment {
publicKey: string;
amount: number;
paymentMethod: "credit_card" | "internet_banking" | "promptpay" | "truemoney" | "truemoney_jumpapp" | "mobile_banking_kbank" | "mobile_banking_bay" | "mobile_banking_bbl" | "mobile_banking_ktb" | "mobile_banking_scb" | "alipay" | "alipay_cn";
currency: "THB" | "USD";
onSuccess: (res: any) => void;
onClose: () => void;
return_uri: string;
}
export declare const openPaymentModal: (payload: IPayment) => void;