@paydock/client-sdk
Version:
Paydock client sdk
63 lines (62 loc) • 2.88 kB
TypeScript
import { CheckoutButton } from '../checkout-button';
import { CHECKOUT_MODE } from '../checkout-button.interface';
import type { ZipmoneyRunnerParams } from './zipmoney.types';
/**
* Class ZipmoneyCheckoutButton is wrapper of CheckoutButton transform usual button into checkout
*
* @extends CheckoutButton
*
* @constructor
*
* @param {string} selector - Selector of html element.
* @param {string} publicKey - PayDock users public key
* @param {string} [gatewayId=default] - PayDock's gatewayId. By default or if put 'default', it will use the selected default gateway
* @param {string} [gatewayId=default] - Checkout mode, it could be set to 'contextual' or 'redirect'. By default it 'contextual'
* @example
* var widget = new ZipmoneyCheckoutButton('#button', 'publicKey','gatewayId');
*/
declare class ZipmoneyCheckoutButton extends CheckoutButton {
protected publicKey: string;
protected gatewayId: string;
protected mode: CHECKOUT_MODE;
/** @constructs */ constructor(selector: string, publicKey: string, gatewayId?: string, mode?: CHECKOUT_MODE);
/**
* Method for setting suspended redirect uri. Redirect after referred checkout
*
* The URI is used for a redirect after the checkout is complete.
* This can be provided, even if using in-context checkout (sdk). By default, the standard styled page will be used.
* If using in-context (sdk) we will not automatically redirect to this URI.
*
* @param {uri} string - uri for suspended redirect (by default)
*/
setSuspendedRedirectUri(uri: string): void;
/**
* Method for setting the merchant redirect URL.
* The merchant's customers would be redirected to the specified URL
* at the end of ZipMoney checkout flow.
*
* Once the redirect URL would be set, the checkout flow would be immediately switched
* from 'contextual' mode to the 'redirect' mode.
* The merchant's customer would be automatically redirected to this URL after the checkout is complete.
*
* @param {url} string - URL for redirect
*/
setRedirectUrl(url: string): void;
protected buildAdditionalParams(): ZipmoneyRunnerParams;
/**
* Subscribe to the click event with an async handler.
* The checkout flow will wait for the async handler to complete before proceeding.
* If the handler resolves to `false`, the checkout flow will be cancelled.
*
* @param handler - Async function to be called when the button is clicked
*
* @example
* button.onClick(async () => {
* const isValid = await fetchDataFromServer();
* return isValid; // return false to stop checkout
* });
*/
onClick<T>(handler: (data?: T) => Promise<boolean | void>): void;
}
export { ZipmoneyCheckoutButton };
//# sourceMappingURL=zipmoney-checkout-button.d.ts.map