Google Pay

How to set it up

To use Headless checkout to accept payments via Google Pay:

  1. Add the handling of the show_fields event for displaying additional fields.
Implementation sample
Refer to the detailed sample on GitHub.
Example:
Copy
Full screen
Small screen
1headlessCheckout.form.onNextAction((nextAction) => {
2  switch (nextAction.type) {
3    case 'show_fields':
4      this.handleShowFieldsAction(nextAction);
5  }
6});
  1. Add the psdk-payment-form component to the HTML markup of the payment UI to display additional fields.
Example:
Copy
Full screen
Small screen
1<psdk-payment-form></psdk-payment-form>
2<psdk-submit-button text="Pay" />
  1. Add the handling of the event for displaying a button to pay via Google Pay.
Example:
Copy
Full screen
Small screen
 1headlessCheckout.form.onNextAction((nextAction) => {
 2  switch (nextAction.type) {
 3    ...
 4    case 'special_button': {
 5      if (nextAction.data.buttonName === 'google-pay') {
 6        showGoogleButton = true;
 7      }
 8    }
 9  }
10});
  1. Add the component of the Google Pay button to the HTML markup of the payment UI.
Example:
Copy
Full screen
Small screen
1@if (showGoogleButton) {
2  <psdk-google-pay-button></psdk-google-pay-button>
3}

One-click payment

One-click payment allows users to pay with Google Pay, a familiar and secure native payment method, on supported devices. To configure one-click payment, update the SDK initialization script as shown below:

Copy
Full screen
Small screen
1const config: InitialOptions = {
2  isWebview: false,
3  theme: 'default',
4  language: parameters.language,
5  isGooglePayInstantFlowEnabled: true
6};
7
8await headlessCheckout.init(config);
Was this article helpful?
Thank you!
Is there anything we can improve? Message
We’re sorry to hear that
Please explain why this article wasn’t helpful to you. Message
Thank you for your feedback!
We’ll review your message and use it to help us improve your experience.
Last updated: February 13, 2026

Found a typo or other text error? Select the text and press Ctrl+Enter.

Report a problem
We always review our content. Your feedback helps us improve it.
Provide an email so we can follow up
Thank you for your feedback!
We couldn't send your feedback
Try again later or contact us at doc_feedback@xsolla.com.