1. Methods
Español
  • Español
  • English
  • Home Page
  • Libraries & SDKs (Online Payments)
    • Release notes
    • Mobile
      • Kushki Android
      • Kushki iOS 
      • Kushki iOS ARM Setup
    • Web
      • Kushki.js 🌐
      • kushki.js-hosted-fields
        • kushki.js Hosted Fields
        • Guía de migración a Kushki.js 2.0
        • Antifraud
          • Interfaces
            • SecureInitRequest
            • SecureInitResponse
            • SiftScienceObject
          • Methods
            • requestInitAntiFraud
            • requestSecureInit
            • requestValidate3DS
        • Card
          • CarApplePay interface
            • ICardApplePay Interface
          • Card-Interface
            • ICard Interface
            • ICardSubscriptions Interface
          • Errors
            • Error list
          • Interfaces
            • Amount
            • ApplePayGetTokenOptions Interface
            • ApplePayOptions Interface
            • ApplePayPaymentContact
            • AppleTokenResponse
            • BrandByMerchantResponse Interface
            • CardFieldValues
            • CardInfo
            • CardOptions
            • CardTokenResponse
            • DeferredByBinOptionsResponse
            • DeferredInputValues
            • DeferredValuesResponse
            • DeviceTokenRequest
            • Field
            • FieldInstance
            • Fields
            • FieldValidity
            • FormValidity
            • MasterCardBrandingRequest
            • SecureDeviceTokenOptions
            • Styles
            • TokenResponse
            • VisaBrandingRequest
          • Methods
            • initApplePayButton
            • initCardToken
            • initSecureDeviceToken
            • requestBrandsByMerchant method
            • requestDeviceToken method
            • requestInitCardBrandingAnimation
          • Types
            • CssProperties
            • Currency
            • FieldTypeEnum
        • Card Payouts
          • Card Payouts Interface
            • ICardPayouts
          • Enumerations
            • Enumeration `InputModelEnum`
          • Errors
            • Errors
          • Interfaces
            • CardPayoutOptions
            • CardPayoutSubscriptionTokenResponse
            • CardPayoutUniqueTokenResponse
            • Field
            • Fields
            • FieldValidity
            • Interface FormValidity
            • Interface `Styles`
          • Methods
            • initCardPayoutToken
          • Type Aliases
            • CardPayoutTokenResponse
            • InputTypeEnum
          • Types
            • CssProperties
        • Kushki
          • Methods
            • init function
            • requestBankList function
            • requestCommissionConfiguration function
          • Classes
            • KushkiError
          • Interfaces
            • CommissionConfigurationRequest
            • IKushki
            • KushkiOptions
Bienvenida
Perú 🇵🇪México 🇲🇽Ecuador 🇪🇨Colombia 🇨🇴Chile 🇨🇱
Bienvenida
Perú 🇵🇪México 🇲🇽Ecuador 🇪🇨Colombia 🇨🇴Chile 🇨🇱
  1. Methods

initApplePayButton

initApplePayButton method

WARNING

Watch Out!
The Apple Pay functionality is currently in a testing phase. It is only available for merchants in Chile 🇨🇱 and Peru 🇵🇪, and supports Visa and Mastercard cards.

Please note that this functionality is subject to change without prior notice.

initApplePayButton(kushkiInstance, options): Promise<ICardApplePay>

Introduction

Function to render the Apple Pay button and initialize an instance of ICardApplePay.

WARNING

Important!
⚠️ Domain Verification Required: To use Apple Pay, you must host the validation file on your server (at the .well-known path) and register your domain in the Kushki Console. The payment flow will not function without this verification on a secure (HTTPS) domain.

For this method to work correctly, you must include the following container in your project’s HTML:

<div id="kushki-apple-pay-button"></div>

Parameters

ParameterTypeDescription
kushkiInstanceIKushkiObject that implements the IKushki interface.
optionsApplePayOptionsVisual and behavioral options for the Apple Pay button.

Visual and behavioral options for the Apple Pay button:

OptionTypeDescription
style"black" | "white"Defines the visual style (color) of the Apple Pay button.
locale"en-US" | "es-ES" | "es-MX" | "pt-BR"Sets the language and region for the Apple Pay button text.
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 label and action displayed on the Apple Pay button.

Returns

Promise <ICardApplePay>.

Instance of ICardApplePay.

Errors

This method may throw the following exceptions:

  • ERRORS.E024: Apple Pay resources were not created.

  • ERRORS.E025: Apple Pay payments are not available.

Initialization Example

HTML Container:

<div id="kushki-apple-pay-button"></div>

Initialize Kushki instance:

const kushkiOptions: KushkiOptions = {
  publicCredentialId: 'public-merchant-id',
  inTest: true
};

Initialize CardApplePay instance:

const options: ApplePayOptions = {
  style: "black",
  locale: "es-MX",
  type: "pay"
};

try {
  const kushkiInstance: IKushki = await init(kushkiOptions);
  const cardApplePay: ICardApplePay = await initApplePayButton(kushkiInstance, options);
} catch (e: any) {
  console.error(e.message);
}

Example: Using Events and Requesting the Token

try {
  const cardApplePay: ICardApplePay = await initApplePayButton(kushkiInstance, options);

  cardApplePay.onCancel(() => {
    console.log("Payment canceled");
  });

  cardApplePay.onClick(async () => {
    try {
      const token = await cardApplePay.requestApplePayToken({
        displayName: "DEMO",
        countryCode: "EC",
        currencyCode: "USD",
        amount: 20
      });

      console.log(token);
    } catch (error) {
      console.log("Error requesting token: ", error);
    }
  });
} catch (e: any) {
  console.error(e.message);
}
Modified at 2026-04-16 14:14:30
Previous
VisaBrandingRequest
Next
initCardToken
Built with