Skip to Content
Docs

Add to checkout

Integrate Apple Pay payments using Pay.com.js or the REST API.

Pay.com supports three integration paths for Apple Pay: Universal checkout, Headless checkout, and the server-to-server API. Choose based on how much control you need over the checkout experience.

Before starting, make sure Apple Pay is enabled on your Pay.com account and your domain is registered. See the Apple Pay overview for prerequisites and dashboard configuration.

Integrate

Integrate Apple Pay with Pay.com.js or directly with the API.

Universal checkout

Apple Pay renders automatically in Universal checkout. No additional code is required beyond the standard SDK initialization. See Universal checkout for setup instructions. Use Universal checkout when you want Pay.com to handle the entire payment flow, including the UI.

Headless checkout

Use Headless checkout when you want to control the user interface and let Pay.com handle the payment logic. You render your own Apple Pay button and control when the payment sheet appears.

Apple Pay is not available in all browsers. Call canMakePayments() after initializing the checkout instance, and show the button only if the result includes applepay: true.

const canMakePaymentsResult = await checkout.canMakePayments()
// Example result: { applepay: true, googlepay: false }

if (canMakePaymentsResult.applepay) {
  // Show your Apple Pay button
}

Trigger the payment when the customer taps the button.

async function handleApplePay() {
  try {
    await checkout.headless('applepay')
  } catch (error) {
    console.log('Payment failed:', error.message)
  }
}

Apple's Human Interface Guidelines require that you use the official Apple Pay button style. Use -webkit-appearance: -apple-pay-button in your CSS or Apple's button guidelines to render the button. Don't substitute a generic button styled to look like Apple Pay.

Testing

Test against https://api.sandbox.pay.com/v1 with your sk-pay-com-sandbox- API key. Test transactions never move real funds. See Environments. To test Apple Pay through Pay.com checkout, use a real Apple device with a card added to Apple Wallet.

ScenarioTest actionExpected result
Successful paymentAuthenticate with Face ID, Touch ID, or the device passcodestatus: succeeded, wallet.type: "applepay" in the response
Customer cancelsTap Cancel on the Apple Pay sheetThe sheet closes and no charge is created.
Apple Pay unavailableOpen checkout in a browser or on a device where Apple Pay is not set upcanMakePayments() returns applepay: false and the Apple Pay button does not render.
Was this page helpful?