Google Assistant (Dialogflow)

Integration published by Jovo | 9,683 downloads

Build apps for Google's Assistant platform using Dialogflow

Google Transactions

Learn how to sell digital and physical goods in your Google Actions by using Google Transactions.


Official Google Docs: Transactions

Transactions for Google Actions allow you to sell both digital and physical goods in your app. The Jovo implementation of Google Transactions can be accessed like this:

The two types (digital and physical goods) differ in functionality and configuration, this is why they are addressed as distinct features in this document.

Learn more below:

Digital Goods

Official Google Docs: Build digital transactions.

Digital transactions allow you to sell in-app product in the Google Play store.

Digital Goods Configuration

Learn more about configurations in the official Google Docs.

Here are some of the steps that need to be taken:

  • Create a Google Developer account
  • Create an app project
  • Download Android Studio
  • Add <uses-permission android:name="" /> to the AndroidManifest.xml file
  • Generate Signed APK from the Build menu
  • Upload APK into Google Playstore

To use transactions for digital goods, you need to install the googleapis npm package:

Next, head to Google Cloud API Console to enable the Actions API:

  1. Visit Google Cloud Console -> APIs & Services
  2. Search "Actions API"
  3. Select "Enable"

Then in src/app.js add the Android App package name you created earlier:

You can generate the ./keyfile.json file by following the instructions:

Digital Goods Implementation

To implement the transaction of digital goods in your Jovo project, there are few things you need to do (in line with the transaction flow described in the Google docs):

Gather Information

There are two types of digital goods that can be sold:

Depending on which type you want to use, you can use the following methods to query the Play store with a list of product IDs (SKUs):

Check the user has met all requirements for Digital Purchase:

The next request will then go into the DIGITAL_PURCHASE_CHECK() inside the ON_TRANSACTION object in your handler:

Build the Order

This part of the flow prompts the user to select an item. Learn in the official docs by Google how to create a rich response that describes the available items to the user.

Complete Purchase

You can use the following method to complete the purchase:

The next request will then go into the ON_COMPLETE_PURCHASE() inside the ON_TRANSACTION object in your handler:

Purchase Status

Inside the COMPLETE_PURCHASE() handler, you can check the purchase status:

The following can be returned:


Physical Goods

Physical transactions allow you to sell physical items (e.g. books, clothes) in your Google Action. You can either choose to do the transaction with Google Pay, or do merchant-managed payments (e.g. by using Stripe).

More below:

Physical Goods Configuration

Build Physical Transactions with Google Pay

Learn more about configurations for Google Pay in the official Google Docs.

Build Physical Transactions with Merchant-Managed Payments

Learn more about configurations for merchant-managed payments in the official Google Docs.

Physical Goods Implementation

You can find an example project on GitHub.

There are several steps that need to be taken to create an order with your physical goods transaction:

Check Requirements

The paymentOptions either need to include googleProvidedOptions or actionProvidedOptions.


To handle transaction events, add the ON_TRANSACTION element to your handler:

ON_TRANSACTION needs to include the following three elements:


After checkRequirements, the next request will go into the TRANSACTION_REQUIREMENTS_CHECK() handler.


There are two helper methods that you can use to query for the requirements in the TRANSACTION_REQUIREMENTS_CHECK() handler:

  • this.$googleAction.$transaction.isRequirementsCheckOk()
  • this.$googleAction.$transaction.isRequirementsCheckUserActionRequired()

When isRequirementsCheckOk is true, you can ask for the delivery address:

The next request will go into the DELIVERY_ADDRESS() handler.


After the user accepted the delivery address (this.$googleAction.$transaction.isDeliveryAddressAccepted()), you can as them to make a transaction decision:

The next request will go into the TRANSACTION_DECISION() handler.


If the order is accepted by the user (this.$googleAction.$transaction.isOrderAccepted()), you can create the order:

Order Update

Find an example file on GitHub: order-update.js.

You can also update orders, which is not related to the Jovo Framework, but mostly happens somewhere else outside your Google Action.

The example file shows how this could look like, and uses the googleapis, which you need to install like this:

Google Assistant Changelog

Current version might be higher than the latest changes displayed below because of updates of dependencies.

2021-07-07 [3.5.4]
  • #948 ✨ Add enableFullScreen and continueTtsDuringTouch (@aswetlow)

2021-02-22 [3.5]

  • #901 Move setResponse from response to after.response middleware (@aswetlow)
2020-11-20 [3.2.3]
2020-11-05 [3.2.1]
  • Fix Transaction API v2/v3 incomptibility

🐛 Bug Fix

  • #716 Corrected logic for retrieving project-ids in staged environments (@m-ripper)

Committers: 3

3.0.11 (2020-04-06)

  • Updated Typescript to 3.8.x
  • Updated Prettier to 2.x

Committers: 2


Find the 2.x changelog here.

Join Our Newsletter

Be the first to get our free tutorials, courses, and other resources for voice app developers.