The Transactions API allows you to accept purchases and reservations with your Assistant app.
A transaction can be a purchase (for example, pick-up, delivery, or tickets), or a reservation/appointment (for example, restaurants, haircuts, fitness classes).
A transaction with Actions on Google generally consists of:
- Delivery address: using the
actions.intent.DELIVERY_ADDRESSintent to retrieve the user's delivery address from Google
- Cart assembly: conducting a conversation with the user to build their order
- Checkout: using the
actions.intent.TRANSACTION_DECISIONintent to propose the order to the user for them to accept or reject (required)
- Confirmation: using the
OrderUpdateresponse to confirm a transaction that a user has already accepted, and send them a receipt (required)
- Sign in / account creation: connecting the user's Google account to an account on your own web application via OAuth 2.0
- Order updates: sending further
OrderUpdates to the user via the Conversation Send API throughout the life of the order (required)
Transactions on the Google Assistant
The Transactions API allows you to create more seamless ordering experiences than other channels like websites and mobile apps. This is because the Google Assistant enables a natural, conversational ordering experience, and can facilitate transactions on the user's behalf by passing payment and identity to your app.
Actions on Google provides a variety of APIs and helpers for building a quality conversational experience in your Assistant app. You can use these to guide users to assemble their "shopping cart" by conversing with your app. Here's an example with a shoe store app:
While the user is building their "cart", you may need to collect their delivery or shipping information to determine things like price and service availability. Your app can request the user's permission for Google to share their delivery address with your app.
Once they are ready to checkout, your app can trigger an order confirmation experience by providing the structured order data to the Transactions API. The user can then authorize the purchase and accept or reject the order. We provide a built-in experience enabling users to change their payment settings, delivery address, etc.
If the user authorizes the purchase, your app should immediately respond by confirming that the order is active. You do this by providing the Transactions API with a structured receipt. This is presented to the user as a rich receipt "card" as part of their interaction with your app.
You can then continue the dialog with the user. You might take this opportunity to let them create an account on your app so that they can earn rewards or re-order their favorite items.
A detailed version of the receipt will appear in the user's Assistant order history. Later, you can use the order ID associated with this receipt to send structured order updates. Important updates will be sent to the user as push notifications.
Integrating with the Transactions API
Integrating with the Transactions API involves the following steps:
- Create a project in the Actions Console and opt-in to Transactions
Use API.AI or other tools to build your app:
- Create a "cart assembly" experience to guide the user to build an order
Prepare a payment method -- you can:
Link the user's Google account with your web service to access a payment method that the user has on file with you
Use Stripe, Braintree, or Vantiv to charge a credit card the user has stored with Google
Take payment "on fulfillment" (e.g. cash on delivery) or not take payment at all (e.g. for some reservations)
Propose the order to the user with the
- Once the user accepts, send a structured receipt
Support and test both Sandbox and Production modes. Test the Transactions API only on Android M+N devices -- not the Actions Web Simulator.
- Use the Conversation Send API to provide structured order update notifications throughout the life of the order
- Submit your app via the Actions Console
See the policies and guidelines document for information on how to distribute your apps to users.