Skip to Content
Docs

Add to checkout

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

Pay.com supports three integration paths for Google 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 Google Pay is enabled on your Pay.com account. See the Google Pay overview for prerequisites and dashboard configuration.

Integrate

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

Universal checkout

Google Pay renders automatically in Universal checkout. No additional code is needed 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 Google Pay button and control when the payment sheet appears.

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

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

if (canMakePaymentsResult.googlepay) {
  // Show your Google Pay button
}

Trigger the payment when the customer taps the button.

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

Google's brand guidelines require that you use the official Google Pay button. Follow the Google Pay brand guidelines when rendering the button. Don't substitute a generic button styled to look like Google 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 Google Pay through Pay.com checkout, use a supported browser with a Google account that has a card saved to Google Pay.

ScenarioTest actionExpected result
Successful paymentAuthenticate through the Google Pay sheetstatus: succeeded, wallet.type: "googlepay" in the response
Customer cancelsDismiss the Google Pay sheetThe sheet closes and no charge is created.
Google Pay unavailableOpen checkout in a browser without Google Pay set upcanMakePayments() returns googlepay: false and the Google Pay button does not render.
Was this page helpful?