Overview

This guide provides details to help developers notify Google about Google Pay transaction information. After a user confirms a Google Pay transaction, the Transaction Events API notifies Google of the payment and its order-related events. Use of the Transaction Events API helps us make informed risk decisions up front and supplements merchant risk checks.

Required API Changes

To configure callbacks for the API, complete the following steps:

  1. Populate the transactionInfo.transactionId field in PaymentDataRequest. You must create a unique ID for this transaction attempt. We suggest that you use an existing ID that you already have to represent this transaction attempt. If you don't have one available, you can generate a specific one for Google Pay transaction attempts to store in your system.

  2. Create a generic Google Account. Share it with your team internally and with Google to add to our allowlist. Your account manager can help you with this process, but they can't create the account for you. Do not give them access to this Google Account.

  3. Create a Google Cloud project. Once Google provides access for the developer's Google Account, the operator must sign in with that account and proceed to the Google Cloud Console. The developer must create a project for this integration. Do not create other projects with the Google Account used to create this project.

  4. Create a new Cloud Billing Account or confirm that billing is enabled on your project.

  5. Enable the Transaction Events API with the VGW API. The Transaction Events API lives under the VGW APIs umbrella. To gain access to the specific endpoint that you need, you must enable the VGW API on your project. To do so, activate your Cloud Shell in the Google Cloud Platform and run the following in the command line: gcloud services enable vgw.googleapis.com

  6. In your project, create and register a service account. Create a service account and notify your Google contact with the email address that's associated with your service account. This links your service account to your merchant profile. It takes about one business day to add your service account to the allowlist.

  7. Once we give your service account access, complete the following steps to make an authorized API call:

    1. Use the short-lived token in a subsequent request to the Transaction Events API. The input file is the private JSON key that's created with the service account. The following is the scope: https://www.googleapis.com/auth/facilitated.transaction.event.service
    2. Construct the request body of the event notification. There are nine event types, such as AuthorizationSucceeded and AuthorizationDeclined. Construct the request for the relevant event notification.
    3. Send an event notification about a transaction. To do so, complete the following steps:
      1. Make an HTTP request to the following: https://vgw.googleapis.com/gsp/facilitated-transaction-event-v2/eventNotification/**merchant_id**
      2. Pass the OAuth token in the header as follows: Authorization: Bearer **token**
      3. Ensure that the merchant_id in your request matches your Merchant ID value in the Google Pay Business Console.

Ensure that your request meets the following criteria:

  • Each request must have a unique requestId.
  • The requestTimestamp can't be greater than 60 seconds in the past or future from the current time.