Kushki Developer Portal
  1. Methods
Kushki Developer Portal
  • KUSHKI API
    • Kushki Developer Portal 🚀
    • Perú 🇵🇪
    • Ecuador 🇪🇨
    • Chile 🇨🇱
    • México 🇲🇽
    • Colombia 🇨🇴
    • 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
          • Javascript
          • Card Payouts
            • Interfaces
              • Interface `FormValidity`
              • Interface `Styles`
              • Interface `CardPayoutUniqueTokenResponse`
              • Interface `CardPayoutSubscriptionTokenResponse`
              • Interface `CardPayoutOptions`
              • Interface `Fields`
              • Interface `Field`
              • Interface `FieldValidity`
            • Type Aliases
              • Type Alias `InputTypeEnum`
              • Type Alias `CardPayoutTokenResponse`
            • Errors
              • Errors
            • Card Payouts Interface
              • Interface `ICardPayouts`
            • Enumerations
              • Enumeration `InputModelEnum`
            • Methods
              • initCardPayoutToken method
            • Types
              • Type Alias `CssProperties`
          • Antifraud
            • Interfaces
              • Untitled Doc
              • Untitled Doc
              • SiftScienceObject Interface
            • Methods
              • Untitled Doc
              • requestInitAntiFraud method
              • Untitled Doc
          • Kushki
            • Interfaces
              • Untitled Doc
              • CommissionConfigurationRequest interfaces
              • Untitled Doc
            • Classes
              • Untitled Doc
            • Methods
              • requestBankList function
              • requestCommissionConfiguration function
              • Kushki.js Hosted Fields init function
          • Card
            • Card-Interface
              • Untitled Doc
              • Untitled Doc
            • Interfaces
              • Untitled Doc
              • AppleTokenResponse Interface
              • Untitled Doc
              • Untitled Doc
              • BrandByMerchantResponse Interface
              • ApplePayOptions Interface
              • ApplePayPaymentContact Interface
              • ApplePayGetTokenOptions Interface
              • Untitled Doc
              • Untitled Doc
              • MasterCardBrandingRequest Interface
              • Untitled Doc
              • Untitled Doc
              • Untitled Doc
              • Untitled Doc
              • Untitled Doc
              • Untitled Doc
              • Untitled Doc
              • Untitled Doc
              • Untitled Doc
              • VisaBrandingRequest Interface
              • Untitled Doc
              • Untitled Doc
              • Untitled Doc
            • CarApplePay interface
              • ICardApplePay Interface
            • Errors
              • Untitled Doc
            • Methods
              • Untitled Doc
              • Untitled Doc
              • Untitled Doc
              • requestInitCardBrandingAnimation method
              • Untitled Doc
              • requestBrandsByMerchant method
            • Types
              • Untitled Doc
              • Untitled Doc
              • Untitled Doc
    • Schemas
      • webhooksChargeback
      • one-and-two-step-payment
      • webhooks
      • transactionType
      • threeDomainSecure
      • product
      • payment_submethod
      • paymentMethod
      • orderDetails
      • headers
      • extraTaxes
      • documentType
      • currency
      • currency-cash-in
      • currency-CL
      • binInfo
      • UnexpectedErrorResponse
      • SubscriptionUpdate
      • SubscriptionAdjustmentRequest
      • Subscription
      • Submerchant
      • Shipping-Address
      • Promotions
      • Metadata
      • Language
      • InvalidBinResponse
      • GetConfigurationRequest
      • ErrorResponse
      • Deferred
      • Country
      • ContactDetails
      • ChargesVoidCardResponse
      • Channel
      • Card
      • Billing-Address
      • BadRequestResponse
      • Amount
      • Amount-cash-in
      • Amount-CL
  • APPIAN-SUBMERCHANT-REGISTER
    • Submerchant Validation in Batch
    • Query submerchant status by requestId/submerchantId
    • Get submerchantIds
    • Get credentials for submerchants
  1. Methods

Untitled Doc


initApplePayButton method

> #### 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.

> #### 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-02-02 22:10:25
Previous
Untitled Doc
Next
Untitled Doc
Built with