Skip to Content
Docs

Detect wallet availability

Detect whether Apple Pay or Google Pay are available in the customer's browser and device.

The checkout.canMakePayments() method detects whether Apple Pay or Google Pay are available in the customer's current browser and device. Call it before you render wallet buttons in a Headless checkout integration.

const result = await checkout.canMakePayments()

Parameters

None.

Returns

FieldTypeDescription
applepaybooleantrue if Apple Pay is available in the current browser.
googlepaybooleantrue if Google Pay is available in the current browser.

The result only ever contains applepay and googlepay. To check whether another payment method is available for the session, use checkout.getPaymentMethods():

const methods = await checkout.getPaymentMethods()
const paypalAvailable = methods.some((m) => m.paymentMethodType === 'paypal')

Example

const canPay = await checkout.canMakePayments()

if (canPay.applepay) {
  // render Apple Pay button
}
if (canPay.googlepay) {
  // render Google Pay button
}
Was this page helpful?