Apple Pay

Take an Apple Pay payment

Usage

Code playground

index.html

Payments

Returned by Square.payments(appId, locationId).

Use this object to instantiate Payment methods. Learn more on the Payments page.

Methods

payments.js
JS
JavaScript

const payments = Square.payments(appId, locationId);

ApplePay

The ApplePay Payment Method.

Requests a payment nonce for a payment card stored in an Apple Pay digital wallet.

Methods

applePay.js
JS
JavaScript

// Create a request to pay 1.00 USD

const paymentRequest = payments.paymentRequest({

  countryCode: 'US',

  currencyCode: 'USD',

  total: {

    amount: '1.00',

    label: 'Total',

  }

});



// Get a new Apple Pay method

const applePay = await payments.applePay(paymentRequest);



const applePayButtonTarget = document.getElementById('applePay');

applePayButtonTarget.onclick = async () => {

  //Start the Apple Pay flow and await the secure token result

  const tokenResult = await applePay.tokenize();



  // Pass the TokenResult to your server to complete the payment

}