/* tslint:disable:all */ /** * Kushki file */ import { AxiosError } from "axios"; import { KushkiError } from "./../lib/generic/KushkiError"; import "reflect-metadata"; import { AppleTokenResponse } from "./../lib/types/apple_pay_get_token_events"; import { ApplePayGetTokenOptions } from "./../lib/types/apple_pay_get_token_options"; import { ApplePayOptions } from "./../lib/types/apple_pay_options"; import { BankListResponse } from "./../lib/types/bank_list_response"; import { BinBody } from "./../lib/types/bin_body"; import { BinInfoResponse } from "./../lib/types/bin_info_response"; import { CardAsyncTokenRequest } from "./../lib/types/card_async_token_request"; import { CardAsyncTokenResponse } from "./../lib/types/card_async_token_response"; import { CardBrandingRequest } from "./../lib/types/card_branding_request"; import { CashTokenRequest } from "./../lib/types/cash_token_request"; import { DeviceTokenRequest } from "./../lib/types/device_token_request"; import { ErrorResponse } from "./../lib/types/error_response"; import { GetBrandsLogosByMerchantResponse } from "./../lib/types/get_brands_logos_by_merchant_response"; import { KushkiInfo } from "./../lib/types/kushki_info"; import { MultiMerchantInfoRequest } from "./../lib/types/multimerchant_info_request"; import { MultiMerchantInfoResponse } from "./../lib/types/multimerchant_info_response"; import { PayoutsCashTokenRequest } from "./../lib/types/payouts_cash_request"; import { PayoutsTransferTokenRequest } from "./../lib/types/payouts_transfer_token_request"; import { CommissionConfigurationAmount } from "./../lib/types/remote/commission_configuration_amount"; import { CommissionConfigurationRequest } from "./../lib/types/remote/commission_configuration_request"; import { IDeferredResponse } from "./../lib/types/remote/deferred_response"; import { TokenResponse } from "./../lib/types/remote/token_response"; import { TransferTokenRequest } from "./../lib/types/remote/transfer_token_request"; import { ResponseStatusValidator } from "./../lib/types/response_status_validator"; import { SecureInitRequest } from "./../lib/types/secure_init_request"; import { SecureInitResponse } from "./../lib/types/secure_init_response"; import { SecureOtpRequest } from "./../lib/types/secure_otp_request"; import { SecureOtpResponse } from "./../lib/types/secure_otp_response"; import { SiftScienceAntiFraudSessionResponse } from "./../lib/types/sift_science_session"; import { SubscriptionCardAsyncTokenRequest } from "./../lib/types/subscription_card_async_token_request"; import { SubscriptionCardAsyncTokenResponse } from "./../lib/types/subscription_card_async_token_response"; import { SubscriptionTokenRequest } from "./../lib/types/subscription_token_request"; import { TokenChargeRequest } from "./../lib/types/token_charge_request"; import { TokenRequest } from "./../lib/types/token_request"; import { TransferSubscriptionTokenRequest } from "./../lib/types/transfer_subscription_token_request"; import { Validate3DSRequest } from "./../lib/types/validate_3ds_request"; import { Validate3DsResponse } from "./../lib/types/validate_3ds_response"; /** * Implementation */ export declare class Kushki { private readonly _merchantId; private readonly _inTestEnvironment; private readonly _cardService; private readonly _multiMerchantInfoService; private readonly _commissionService; private readonly _cashService; private readonly _transferService; private readonly _kushkiService; private readonly _regional; private readonly _secureService; private readonly _cardAsyncService; private readonly _payoutsCashService; private readonly _transferSubscriptionService; private readonly _payoutsTransferService; private readonly _cardDynamicService; private readonly _cardSubscriptionDynamicService; private readonly _siftScience; private readonly _applePayService; constructor(body: { merchantId: string; inTestEnvironment?: boolean; regional?: boolean; kushkiInfo?: KushkiInfo; }); requestToken(body: TokenRequest, callback: (value: TokenResponse | ErrorResponse) => void): void; requestInitAntiFraud(userId: string, callback: (value: SiftScienceAntiFraudSessionResponse | ErrorResponse) => void): void; /** * @deprecated use requestDeviceToken instead * @param {Function} body with value * @param {Function} callback with value * @returns {void} */ requestTokenCharge(body: TokenChargeRequest, callback: (value: TokenResponse | ErrorResponse) => void): void; requestDeviceToken(body: DeviceTokenRequest, callback: (value: TokenResponse | ErrorResponse) => void): void; requestSubscriptionToken(body: SubscriptionTokenRequest, callback: (value: TokenResponse | ErrorResponse) => void): void; requestTransferToken(body: TransferTokenRequest, callback: (value: TokenResponse | ErrorResponse) => void): void; checkStatus(callback: (value: ResponseStatusValidator | ErrorResponse) => void): void; /** * @deprecated since version 1.19.8 use requestBankList instead * @param {Function} callback with value * @returns {void} */ requestPseBankList(callback: (value: BankListResponse | ErrorResponse) => void): void; requestBankList(callback: (value: BankListResponse | ErrorResponse) => void): void; requestDeferred(body: BinBody, callback: (value: IDeferredResponse[] | ErrorResponse) => void): void; requestBinInfo(body: BinBody, callback: (value: BinInfoResponse | ErrorResponse) => void): void; requestBrandsByMerchant(callback: (value: string[] | ErrorResponse) => void): void; requestBrandsLogosByMerchant(callback: (value: GetBrandsLogosByMerchantResponse[] | ErrorResponse) => void): void; requestCashToken(body: CashTokenRequest, callback: (value: TokenResponse | ErrorResponse) => void): void; requestSecureServiceValidation(body: SecureOtpRequest, callback: (value: SecureOtpResponse | ErrorResponse) => void): void; requestCardAsyncToken(body: CardAsyncTokenRequest, callback: (value: CardAsyncTokenResponse | ErrorResponse) => void): void; requestSubscriptionCardAsyncToken(body: SubscriptionCardAsyncTokenRequest, callback: (value: SubscriptionCardAsyncTokenResponse | ErrorResponse) => void): void; multiMerchantInfo(body: MultiMerchantInfoRequest, callback: (value: MultiMerchantInfoResponse | ErrorResponse) => void): void; requestPayoutsCashToken(body: PayoutsCashTokenRequest, callback: (value: TokenResponse | ErrorResponse) => void): void; requestPayoutsTransferToken(body: PayoutsTransferTokenRequest, callback: (value: TokenResponse | ErrorResponse) => void): void; getCommissionConfiguration(body: CommissionConfigurationRequest, callback: (value: CommissionConfigurationAmount | ErrorResponse) => void): void; requestTransferSubscriptionToken(body: TransferSubscriptionTokenRequest, callback: (value: TokenResponse | ErrorResponse) => void): void; requestTransferSubscriptionBankList(callback: (value: BankListResponse | ErrorResponse) => void): void; requestPayoutsTransferBankList(callback: (value: BankListResponse | ErrorResponse) => void): void; /** * @deprecated Method has been fully removed * @param {object} _body unused * @param {function} callback always return error * @returns {void} */ requestMobileProcessorToken(_body: object, callback: (value: ErrorResponse) => void): void; requestCardDynamicToken(bin: BinBody, body: CardAsyncTokenRequest | TokenRequest, callback: (value: TokenResponse | ErrorResponse) => void): void; requestCardSubscriptionDynamicToken(bin: BinBody, body: SubscriptionCardAsyncTokenRequest | SubscriptionTokenRequest, callback: (value: TokenResponse | ErrorResponse) => void): void; requestValidate3DS(body: Validate3DSRequest, callback: (value: Validate3DsResponse | ErrorResponse) => void): void; requestSecureInit(body: SecureInitRequest, callback: (value: SecureInitResponse | ErrorResponse) => void): void; /** * @param {Function} callback - function to execute when animation ends. * @param {ErrorResponse} [callback.error] - return when throw an error during the animation. * @param {VisaBrandingRequest | MasterCardBrandingRequest} body - configurations of the animation. * @param {string} body.brand - Visa/MasterCard param - card brand ["visa" | "mastercard"] * @param {string} [body.color="white"] - Visa param - The background of animation ["white" | "blue" | "blur"]. * @param {boolean} [body.constrained=false] - Visa param - The container visualization. * @param {boolean} [body.sound=false] - Visa param - The activation of the sound. * @param {string} [body.checkmark="none"] - Visa param - The visualization of checkmark ["none" | "checkmark" | "checkmarkWithText"]. * @param {string} [body.checkmarkTextOption="approved"] - Visa param - The text to appear if checkmarkWithText is enabled ["approved" | "success" | "complete"]. * @param {string} [body.languageCode="es"] - Visa param - The language of the checkmark text ["es" | "en" | "pt_br"]. * @param {string} [body.type="default"] - MasterCard param - define type of component ["default" | "animation-only" | "sound-only"]. * @param {boolean} [body.clearBackground=false] - MasterCard param - clears the background. * @returns {void} */ initCardBrandingAnimation(callback: (error?: ErrorResponse) => void, body: CardBrandingRequest): void; /** * Initializes and renders the Apple Pay button inside the HTML container * with the id `kushki-apple-pay-button`. * * For this method to work correctly, you must have the following container * in your project’s HTML: * * ```html *
* ``` * * ### Example usage: * ```ts * kushki.initApplePayButton( * { style: "white", type: "pay", locale: "es-MX" }, * () => console.log("init"), * () => console.log("clicked, you can start request token process...."), * error => console.log("error", error) * ); * ``` * * @param {ApplePayOptions} options - Visual and behavioral options for the Apple Pay button. * - **style**: `"black"` | `"white"` → button style. * - **locale**: `"en-US"` | `"es-ES"` | `"es-MX"` | `"pt-BR"` → language/region for the button. * - **type**: `"add-money" | "book" | "buy" | "check-out" | "continue" | "contribute" | * "donate" | "order" | "pay" | "plain" | "reload" | "rent" | "set-up" | * "subscribe" | "support" | "tip" | "top-up"` → defines the text/action displayed on the button. * * @param {Function} onInit - Callback executed when: * - All merchant validations and resources have been successfully verified. * - The button has been successfully rendered inside the container. * * @param {Function} onClick - Callback executed only if: * - The button was successfully initialized. * - The user clicks the button. * - Typically used to start the Apple Pay token request process. * * @param {Function} onError - Callback executed if an error occurs during button initialization. * Receives an {@link ErrorResponse} object with the following properties: * - **code**: error code (e.g., `E019`, `E020`). * - **message**: human-readable error description. * - **error**: additional error details. * * ### Possible errors (`ErrorResponse.code`): * - `E019`: Apple Pay resources were not created. * - `E020`: Apple Pay payments are not available. * * @returns {void} */ initApplePayButton(options: ApplePayOptions, onInit: () => void, onClick: () => void, onError: (error: ErrorResponse) => void): void; /** * Starts the Apple Pay payment flow and requests a Kushki card token * to charge a transaction. * * > ⚠️ This method requires that {@link initApplePayButton} has been successfully * initialized and rendered beforehand. * * ### Example usage: * ```ts * kushki.requestApplePayToken( * { * countryCode: "EC", * currencyCode: "USD", * displayName: "My Store", * amount: 5000 * }, * response => { * if ("token" in response) { * console.log("Card token:", response.token); * } else { * console.error("Error requesting token:", response); * } * }, * () => { * console.log("User cancelled Apple Pay payment flow"); * } * ); * ``` * * **Subscription Token:** * * You can make a subscription payment request by setting the `isSubscription` property to `true` in the options parameter. * This will return a subscription token that can be used for recurring payments. * * > ⚠️ This method requires that {@link initApplePayButton} has been successfully * initialized and rendered beforehand. * * ### Example usage: * ```ts * kushki.requestApplePayToken( * { * countryCode: "EC", * currencyCode: "USD", * displayName: "My Store", * amount: 5000, * isSubscription: true * }, * response => { * if ("token" in response) { * console.log("Subscription token:", response.token); * } else { * console.error("Error requesting token:", response); * } * }, * () => { * console.log("User cancelled Apple Pay payment flow"); * } * ); * ``` * * @param {ApplePayGetTokenOptions} options - Configuration options for the Apple Pay payment request. * - **countryCode**: Merchant’s country (e.g., `"MX"`, `"CO"`, `"EC"`, etc.). * - **currencyCode**: Currency for the transaction (e.g., `"USD"`, `"MXN"`, `"COP"`, etc.). * - **displayName**: The merchant name displayed in the Apple Pay sheet. * - **amount**: Transaction amount. * - **optionalApplePayFields**: Additional Apple Pay configuration fields, * - **isSubscription**: Indicates if the payment is for a subscription. If `true`, the token will be a subscription token. If `false` or not provided, the token will be a card token. * following Apple’s specification: * {@link https://developer.apple.com/documentation/applepayontheweb/applepaypaymentrequest} * These fields allow merchants to customize their checkout experience * (e.g., required shipping methods, billing address, etc.). * * @param {Function} callback - Callback executed when the payment flow finishes. * - On success, returns an {@link AppleTokenResponse}: * - **token**: Kushki card token (always returned). * - **billingContact**: Apple Pay billing contact (if requested in the payment configuration). * - **shippingContact**: Apple Pay shipping contact (if requested in the payment configuration). * - On failure, returns an {@link ErrorResponse}: * - **E006**: Error requesting Apple Pay token. * - **E007**: Error starting session. * - **E020**: Apple Pay payments are not available. * * @param {Function} onCancel - Callback executed if the payment flow is cancelled, * either by the user or due to an unexpected error during the process. * * @returns {void} */ requestApplePayToken(options: ApplePayGetTokenOptions, callback: (value: AppleTokenResponse | ErrorResponse) => void, onCancel: () => void): void; static callbackError(err: ErrorResponse | KushkiError | AxiosError, callback: (value: ErrorResponse) => void): void; private _requestBankList; private _requestDeviceToken; private _resolve; }