Build Physical Transactions with Google Pay

This guide will walk you through the process of developing an Actions project that incorporates transactions for physical goods and uses Google Pay for payment.

Transaction flow

When your Actions project handles physical transactions using Google Pay, it will use the following flow:

  1. Gather information (optional) - Depending on the nature of your transaction, you may want to gather the following information from the user at the start of the conversation.
    1. Validate transaction requirements - You can use the transactions requirements helper at the start of the conversation to make sure the user's payment information is properly configured and available before the user builds their cart.
    2. Request a delivery address - If your transaction requires a delivery address, you can request fulfillment of the delivery address helper intent to gather one from the user.
  2. Build the order - You walk the user through a "cart assembly" where they pick which items they want to purchase.
  3. Propose the order - Once the cart is complete, you propose the order to the user so they can confirm it's correct. If the order is confirmed, you'll receive a response with order details and a payment token.
  4. Finalize the order and send a receipt - With the order confirmed, update your inventory tracking or other fulfillment services and then send a receipt to the user.
  5. Send order updates - Over the course of the order fulfillment's lifespan, you'll give the user order updates by sending POST requests to the Actions API.

Review guidelines

Before you get started, we recommend you review our transaction design tips to ensure your conversation is helpful for users.

Keep in mind that additional policies apply to Actions with transactions. Please be sure to review our policies and guidelines for transactions.

Actions that sell physical goods can currently only be deployed in the following countries:

  • Australia
  • Brazil
  • Canada
  • Denmark
  • France
  • Germany
  • Indonesia
  • Italy
  • Japan
  • Mexico
  • Netherlands
  • Norway
  • Poland
  • Russia
  • Singapore
  • Spain
  • Sweden
  • Thailand
  • Turkey
  • United Kingdom
  • United States

Build your project

For an example of a complete transactional conversation, check out our transactions sample.

Setup

When creating your Actions project, you must specify that you want to perform transactions.

To get started, you will need to perform the following steps in the Actions Console:

  1. Create a new project or import an existing project.
  2. Navigate to Deploy > Directory information.
  3. Under Additional information > Transactions, check the box that says "Do your Actions perform Transactions?".

1. Gather information (optional)

1a. Validate transaction requirements (optional)

User experience

As soon as the user has indicated they wish to make a purchase, we recommend triggering the actions.intent.TRANSACTION_REQUIREMENTS_CHECK intent to quickly ensure they will be able to perform a transaction. For example, when invoked, your Action might ask, "would you like to order shoes, or check your account balance?" If the user says "order shoes", you should request this intent right away. This will ensure that they can proceed and give them an opportunity to fix any settings preventing them from continuing with the transaction.

Requesting the transactions requirements check intent will result in one of the following outcomes:

  • If the requirements are met, the intent will be sent back to your fulfillment with a success condition and you can proceed with building the user's order.
  • If one or more of the requirements cannot be met, the intent will be sent back to your fulfillment with a failure condition. In this case, you should pivot the conversation away from the transactional experience, or end the conversation.
    • If any errors resulting in the failure state can be fixed by the user, they will be prompted to resolve those issues on their device. If the conversation is taking place on a voice-only surface, a handoff will be initiated to the user's phone.
Fulfillment

If you want to manually ensure that a user meets transaction requirements, request fulfillment of the actions.intent.TRANSACTION_REQUIREMENTS_CHECK intent with a TransactionRequirementsCheckSpec data object, which defines the following properties:

  • orderOptions - Customer information your Action requires for the transactions.
    • requestDeliveryAddress - If true, delivery address is required for the order.
    • customerInfoOptions.customerInfoProperties[] - Array of CustomerInfoProperty enum. Currently, the only valid value is "EMAIL".
  • paymentOptions
    • googleProvidedOptions.supportedCardNetworks[] - Valid card networks for the user to use to pay. Array of CardNetwork enum, which has valid values: "AMEX", "DISCOVER", "MASTERCARD", "VISA", "JCB".
    • googleProvidedOptions.prepaidCardDisallowed - Boolean indicating whether the user may pay with a prepaid card on file with Google.
Check requirements

You can check to see if a user satisfies transactions requirements by using the client library:

Node.js

conv.ask(new TransactionRequirements({
  orderOptions: {
    requestDeliveryAddress: false,
  },
  paymentOptions: {
    googleProvidedOptions: {
      prepaidCardDisallowed: false,
      supportedCardNetworks: ['VISA', 'AMEX'],
      // These will be provided by payment processor,
      // like Stripe, Braintree, or Vantiv.
      tokenizationParameters: {},
    },
  },
}));

Dialogflow JSON

"data": {
  "google": {
    "expectUserResponse": true,
    "isSsml": false,
    "noInputPrompts": [],
    "systemIntent": {
      "data": {
        "@type": "type.googleapis.com/google.actions.v2.TransactionRequirementsCheckSpec",
        "paymentOptions": {
          "googleProvidedOptions": {
            "prepaidCardDisallowed": false,
            "supportedCardNetworks": [
              "VISA",
              "AMEX"
            ],
            "tokenizationParameters": {
              "parameters": {},
              "tokenizationType": "PAYMENT_GATEWAY"
            }
          }
        }
      },
      "intent": "actions.intent.TRANSACTION_REQUIREMENTS_CHECK"
    }
  }
}
Receive the result of a requirements check

After the Assistant fulfills the intent, it sends your fulfillment a request with the actions.intent.TRANSACTION_REQUIREMENTS_CHECK intent with the result of the check.

To properly handle this request, declare a Dialogflow intent that's triggered by the actions_intent_TRANSACTION_REQUIREMENTS_CHECK event. When triggered, handle it in your fulfillment using the client library:

Node.js

const arg = conv.arguments.get('TRANSACTION_REQUIREMENTS_CHECK_RESULT');
  if (arg && arg.resultType ==='OK') {
    // Normally take the user through cart building flow
    conv.ask(`Looks like you're good to go! ` +
      `Try saying "Get Delivery Address".`);
  } else {
    conv.close('Transaction failed.');
  }

1b. Request a delivery address (optional)

If your transaction requires a user's delivery address, you can request fulfillment of the actions.intent.DELIVERY_ADDRESS intent. This might be useful for determining the total price, delivery/pickup location, or for ensuring the user is within your service region.

When requesting this intent to be fulfilled, you pass in a reason option that allows you to preface the Assistant's request to obtain an address with a string. For example, if you specify "to know where to send the order", the Assistant might ask the user:

"To know where to send the order, I'll need to get your delivery address"

User experience

On surfaces with a screen, the user will choose which address they want to use for the transaction. If they haven't previously given an address, they'll be able to enter a new address.

On voice-only surfaces, the Assistant will ask the user for permission to share their default address for the transaction. If they haven't previously given an address, the conversation will be handed off to a phone for entry.

Request the address

Node.js

conv.ask(new DeliveryAddress({
  addressOptions: {
    reason: 'To know where to send the order',
  },
}));

Dialogflow JSON

"data": {
  "google": {
    "expectUserResponse": true,
    "isSsml": false,
    "noInputPrompts": [],
    "systemIntent": {
      "data": {
        "@type": "type.googleapis.com/google.actions.v2.DeliveryAddressValueSpec",
        "addressOptions": {
          "reason": "To know where to send the order"
        }
      },
      "intent": "actions.intent.DELIVERY_ADDRESS"
    }
  }
}
Receive the address

After the Assistant fulfills the intent, it sends your fulfillment a request with the actions.intent.DELIVERY_ADDRESS intent.

To properly handle this request, declare a Dialogflow intent that's triggered by the actions_intent_DELIVERY_ADDRESSevent. When triggered, handle it in your fulfillment using the client library:

Node.js

const arg = conv.arguments.get('DELIVERY_ADDRESS_VALUE');
  if (arg.userDecision ==='ACCEPTED') {
    console.log('DELIVERY ADDRESS: ' +
      arg.location.postalAddress.addressLines[0]);
    conv.ask('Great, got your address! Now say "confirm transaction".');
  } else {
    conv.close('Transaction failed.');
  }

2. Build the order

User experience

Once you have the user information you need, you'll build a "cart assembly" experience that guides the user to build an order. Every Action will likely have a slightly different cart assembly flow as appropriate for your product or service.

You could build a cart assembly experience that enables the user to re-order their most recent purchase via a simple yes or no question. You could also present the user a carousel or list card of the top "featured" or "recommended" items. We recommend using rich responses to present the user's options visually, but also design the conversation such that the user can build their cart using only their voice.

For more information on how to build a high-quality cart assembly experience, see the Transactions Design Guidelines.

Fulfillment

Throughout your conversation, you'll need to gather the items that a user wants to add to their order and then construct a ProposedOrder that consists of:

  • merchant - identifies you by ID and name.
  • lineItems - collection of items in the order cart.
  • totalPrice - the price of all items in the cart.
  • otherItems - tax and subtotal that can be displayed on the user's receipt when the order is completed.
  • extension.locations - the locations (e.g. pickup, delivery, etc.) associated with the order.

You will also want to collect other information that will be "proposed" to the user as part of the transaction request, such as their preferred payment method and delivery location.

See the conversation webhook documentation and Node.js client library reference for more information.

Node.js

const order = {
  id: UNIQUE_ORDER_ID,
  cart: {
    merchant: {
      id: 'book_store_1',
      name: 'Book Store',
    },
    lineItems: [
      {
        name: 'My Memoirs',
        id: 'memoirs_1',
        price: {
          amount: {
            currencyCode: 'USD',
            nanos: 990000000,
            units: 3,
          },
          type: 'ACTUAL',
        },
        quantity: 1,
        subLines: [
          {
            note: 'Note from the author',
          },
        ],
        type: 'REGULAR',
      },
      {
        name: 'Memoirs of a person',
        id: 'memoirs_2',
        price: {
          amount: {
            currencyCode: 'USD',
            nanos: 990000000,
            units: 5,
          },
          type: 'ACTUAL',
        },
        quantity: 1,
        subLines: [
          {
            note: 'Special introduction by author',
          },
        ],
        type: 'REGULAR',
      },
      {
        name: 'Their memoirs',
        id: 'memoirs_3',
        price: {
          amount: {
            currencyCode: 'USD',
            nanos: 750000000,
            units: 15,
          },
          type: 'ACTUAL',
        },
        quantity: 1,
        subLines: [
          {
            lineItem: {
              name: 'Special memoir epilogue',
              id: 'memoirs_epilogue',
              price: {
                amount: {
                  currencyCode: 'USD',
                  nanos: 990000000,
                  units: 3,
                },
                type: 'ACTUAL',
              },
              quantity: 1,
              type: 'REGULAR',
            },
          },
        ],
        type: 'REGULAR',
      },
      {
        name: 'Our memoirs',
        id: 'memoirs_4',
        price: {
          amount: {
            currencyCode: 'USD',
            nanos: 490000000,
            units: 6,
          },
          type: 'ACTUAL',
        },
        quantity: 1,
        subLines: [
          {
            note: 'Special introduction by author',
          },
        ],
        type: 'REGULAR',
      },
    ],
    notes: 'The Memoir collection',
    otherItems: [
      {
        name: 'Subtotal',
        id: 'subtotal',
        price: {
          amount: {
            currencyCode: 'USD',
            nanos: 220000000,
            units: 32,
          },
          type: 'ESTIMATE',
        },
        type: 'SUBTOTAL',
      },
      {
        name: 'Tax',
        id: 'tax',
        price: {
          amount: {
            currencyCode: 'USD',
            nanos: 780000000,
            units: 2,
          },
          type: 'ESTIMATE',
        },
        type: 'TAX',
      },
    ],
  },
  otherItems: [],
  totalPrice: {
    amount: {
      currencyCode: 'USD',
      nanos: 0,
      units: 35,
    },
    type: 'ESTIMATE',
  },
};

Dialogflow JSON

"proposedOrder": {
  "cart": {
    "lineItems": [
      {
        "id": "My Memoirs",
        "name": "memoirs_1",
        "price": {
          "amount": {
            "currencyCode": "USD",
            "nanos": 990000000,
            "units": 3
          },
          "type": "ACTUAL"
        },
        "quantity": 1,
        "subLines": [
          {
            "note": "Note from the author"
          }
        ],
        "type": "REGULAR"
      },
      {
        "id": "Memoirs of a person",
        "name": "memoirs_2",
        "price": {
          "amount": {
            "currencyCode": "USD",
            "nanos": 990000000,
            "units": 5
          },
          "type": "ACTUAL"
        },
        "quantity": 1,
        "subLines": [
          {
            "note": "Special introduction by author"
          }
        ],
        "type": "REGULAR"
      },
      {
        "id": "Their memoirs",
        "name": "memoirs_3",
        "price": {
          "amount": {
            "currencyCode": "USD",
            "nanos": 750000000,
            "units": 15
          },
          "type": "ACTUAL"
        },
        "quantity": 1,
        "type": "REGULAR"
      },
      {
        "id": "Our memoirs",
        "name": "memoirs_4",
        "price": {
          "amount": {
            "currencyCode": "USD",
            "nanos": 490000000,
            "units": 6
          },
          "type": "ACTUAL"
        },
        "quantity": 1,
        "type": "REGULAR"
      }
    ],
    "merchant": {
      "id": "book_store_1",
      "name": "Book Store"
    },
    "notes": "The Memoir collection",
    "otherItems": []
  },
  "id": "<UNIQUE_ORDER_ID>",
  "otherItems": [
    {
      "id": "Subtotal",
      "name": "subtotal",
      "price": {
        "amount": {
          "currencyCode": "USD",
          "nanos": 220000000,
          "units": 32
        },
        "type": "ESTIMATE"
      },
      "type": "SUBTOTAL"
    },
    {
      "id": "Tax",
      "name": "tax",
      "price": {
        "amount": {
          "currencyCode": "USD",
          "nanos": 780000000,
          "units": 2
        },
        "type": "ESTIMATE"
      },
      "type": "TAX"
    }
  ],
  "totalPrice": {
    "amount": {
      "currencyCode": "USD",
      "nanos": 0,
      "units": 35
    },
    "type": "ESTIMATE"
  }
}

3. Propose the order

Once you've built an order, you must present it to the user to confirm or reject. You do this by requesting the actions.intent.TRANSACTION_DECISION intent and providing the order that you built.

User Experience

When you request the actions.intent.TRANSACTION_DECISION intent, the Assistant initiates a built-in experience in which the ProposedOrder you passed is rendered directly onto a "cart preview card". The user can say "place order", decline the transaction, or change a payment option like the credit card or address.

The user might also say something that is not matched by our built-in experience, like "change my latte to a triple". In this case, the query will be sent to your Action like a normal query. You should set up your Dialogflow intents to be ready for order change requests such as this.

Fulfillment

When you request the actions.intent.TRANSACTION_DECISION intent, you'll create a TransactionDecision that contains the ProposedOrder as well as your OrderOptionsand PaymentOptions.

Your PaymentOptions will include tokenizationParameters that change depending on which Google Pay processor you plan on using (such as Stripe, Braintree, ACI, etc). Read the Google Pay API reference for details on the parameters for each payment gateway.

The following code shows an example TransactionDecision for a payment using Stripe:

Node.js

conv.ask(new TransactionDecision({
  orderOptions: {
    requestDeliveryAddress: false,
  },
  paymentOptions: {
    googleProvidedOptions: {
      prepaidCardDisallowed: false,
      supportedCardNetworks: ['VISA', 'AMEX'],
      // These will be provided by payment processor,
      // like Stripe, Braintree, or Vantiv.
      tokenizationParameters: {
        "gateway": "stripe",
        "stripe:publishableKey": (conv.sandbox ? "pk_test_key" : "pk_live_key"),
        "stripe:version": "2017-04-06"
      },
    },
  },
  proposedOrder: order,
}));

Dialogflow JSON

"google": {
  "expectUserResponse": true,
  "isSsml": false,
  "noInputPrompts": [],
  "systemIntent": {
    "data": {
      "@type": "type.googleapis.com/google.actions.v2.TransactionDecisionValueSpec",
      "paymentOptions": {
        "googleProvidedOptions": {
          "prepaidCardDisallowed": false,
          "supportedCardNetworks": [
            "VISA",
            "MASTERCARD"
          ],
          "tokenizationParameters": {
            "parameters": {
              "gateway": "<GATEWAY>",
              "stripe:publishableKey": "<PUBLISHABLE_KEY>",
              "stripe:version": "<API_VERSION>"
            },
            "tokenizationType": "PAYMENT_GATEWAY"
          }
        }
      },
      "proposedOrder": ...
    },
    "intent": "actions.intent.TRANSACTION_DECISION"
  }
}
Handle the user's decision

After the Assistant fulfills the intent, it sends your fulfillment a request with the actions_intent_TRANSACTION_DECISION intent with the user's answer to the transaction decision. You will receive an Argument containing a TransactionDecisionValue. This value will contain:

  • transactionRequirementsCheckResult.resultType - before presenting the cart preview card to the user, the Assistant will automatically perform the same logic contained in the actions.intent.TRANSACTION_REQUIREMENTS_CHECK intent. The result of this is contained in the resultType field. Possible values are "OK", "USER_ACTION_REQUIRED", "ASSISTANT_SURFACE_NOT_SUPPORTED" and "REGION_NOT_SUPPORTED".
  • userDecision - the user's decision regarding the proposed order. Possible values are "ORDER_ACCEPTED", "ORDER_REJECTED", "DELIVERY_ADDRESS_UPDATED", and "CART_CHANGE_REQUESTED".
  • deliveryAddress - an updated address, if the user changed the delivery address. In this case, userDecision will be "DELIVERY_ADDRESS_UPDATED".

Assuming userDecision was "ORDER_ACCEPTED":

  • order.finalOrder - a copy of the ProposedOrder that was originally passed
  • order.googleOrderId - a Google-generated order ID that can be used to reference the order later
  • order.orderDate - the date and time the order was created
  • order.paymentInfo - the details regarding the payment method that must be used to charge the user
    • paymentType - one of "PAYMENT_CARD", "BANK', "LOYALTY_PROGRAM", "ON_FULFILLMENT", "GIFT_CARD"
    • googleProvidedPaymentInstrument.instrumentToken - contains a Base64-encoded payment token provided by a third-party payment processor
  • order.customerInfo - any customer information (e.g. email address) requested

To properly handle this request, declare a Dialogflow intent that's triggered by the actions_intent_TRANSACTION_DECISION event. When triggered, handle it in your fulfillment using the client library:

Node.js

const arg = conv.arguments.get('TRANSACTION_DECISION_VALUE');
if (arg && arg.userDecision ==='ORDER_ACCEPTED') {
  const googleOrderId = arg.order.googleOrderId;
}

4. Finalize the order and send a receipt

When the actions.intent.TRANSACTION_DECISION intent returns with a userDecision of ORDER_ACCEPTED, you must immediately perform whatever processing is required to "confirm" the order (likely including persisting it in your own database and charging the user). You must then send a "receipt" in an OrderUpdate object with actionOrderId in your next response.

You can choose to either end the dialog or include a further prompt with the receipt. Once an order has been placed, Google will provide an order ID. Attempting to place that same order again will have no result.

When you provide this initial OrderUpdate, a "collapsed receipt card" will be displayed along with the rest of your response. This will mirror the receipt that the user will be able to find in their Order History.

During order confirmation, you should pass a userVisibleOrderId. This can be the provided googleOrderId or your own custom identifier. Note that it will be displayed to the user in their receipt.

Finally, as part of the OrderUpdate, you should provide orderManagementActions. These manifest as URL buttons at the bottom of the order details that the user can find in their Assistant Order History. We require that you provide, at a minimum, a VIEW_DETAILS OrderManagementAction with each order. This should contain a deep-link to the representation of the order on your mobile app or website. Note that OrderManagementActions can also be provided as part of the OrderUpdate you send via the Actions API (see below).

Fulfillment

Node.js

conv.ask(new OrderUpdate({
  actionOrderId: googleOrderId,
  orderState: {
    label: 'Order created',
    state: 'CREATED',
  },
  receipt: {
    userVisibleOrderId: '',
  },
  updateTime: new Date().toISOString(),
}));
conv.ask(`Transaction completed! You're all set! Would you like to do anything
else?'`);

5. Send order updates

After the order has been created, we require that you send order updates throughout the life of the order. You provide order updates by sending an HTTP POST request to the Actions API with the order status and details.

Some important order updates will result in a push notification being sent to the user's Assistant-enabled mobile devices.

Order update details

After the user accepts the proposed order, you'll need to send an order update with a status of CREATED, along with a simple text response.

  • CREATED - Order is accepted by the user and "created" from the perspective of your Action but not yet confirmed; for example, if manual processing is required.

Over the course of the order's fulfillment, you'll also need to send the user updates with the following statuses:

  1. CONFIRMED - Order is confirmed - i.e., it is active and being processed for fulfillment.
  2. IN_TRANSIT - Order has been shipped and is on its way for delivery.
  3. FULFILLED - Order has been delivered.
  4. RETURNED - Order has been returned by the user after delivery.

You can also use the following statuses if needed:

  • REJECTED - If you were unable to process, charge, or otherwise "activate" the order.
  • CANCELLED - Order was cancelled by the user.

The order updates themselves refer to an order either by a Google-generated ID or an ID provided by you while the transaction is initially being created and confirmed.

Authorize requests to the Actions API

Order update requests to the Actions API are authorized by an access token. To POST an order update to the Actions API, you'll need to download a JSON service account key associated with your Actions Console project, then exchange the service account key for a bearer token that can be passed into the Authorization header of the HTTP request.

To retrieve your service account key, perform the following steps:

  1. Follow this link, swapping "example-project-1" for your project ID: https://console.developers.google.com/apis/api/actions.googleapis.com/overview?project=example-project-1
    • You can find your Actions project ID in the Actions console project settings by clicking the gear icon in the navigation bar.
    • If you see an Enable button, click it.
  2. Follow this link, swapping "example-project-1" for your project ID: https://console.developers.google.com/apis/credentials?project=example-project-1
  3. Click Credentials > Create credentials > Service account key.
  4. Under Service Account, click New Service Account.
  5. Give the service account a name like orderupdater.
  6. Set Role to Project > Owner.
  7. Select the JSON key type.
  8. Click Create.
  9. A JSON service account key will be downloaded to the local machine.

In your order updates code, you can exchange your service key for a bearer token using the Google APIs client library and the "https://www.googleapis.com/auth/actions.fulfillment.conversation" scope. You can find installation steps and examples on the API client library GitHub page.

You can also reference order-update.js in our transactions sample for an example key exchange.

Send order updates

Once you've exchanged your service account key for an OAuth bearer token, you can send order updates as authorized POST requests to the Actions API. The URL of the Actions API is:

POST https://actions.googleapis.com/v2/conversations:send

The following headers should be provided:

  1. "Authorization: Bearer $token" where $token is the OAuth bearer token you exchanged your service account key for.
  2. "Content-Type: application/json".

The POST request should take a JSON body of the following format:

{ "customPushMessage": { "orderUpdate": OrderUpdate } }

The OrderUpdate follows the format documented here. The top-level required fields are:

  • Either googleOrderId or actionOrderId - you may use the latter if you previously included a receipt containing a userVisibleOrderId.
  • orderState - the actual order state.
  • updateTime - the exact time that the state changed (Total seconds since 1970/01/01).
  • orderManagementActions - these will be reset with each order update.
  • userNotification - a userNotification object with the title and text used for the update notification.

Node.js


// Import the 'googleapis' module for authorizing the request.
const google = require('googleapis');

// Import the 'request' module for sending an HTTP POST request.
const request = require('request');

// Import the OrderUpdate class from the Actions on Google client library.
const {OrderUpdate} = require('actions-on-google');

// Import the service account key used to authorize the request. Replace the
// string path with a path to your service account key.
const key = require('./path/to/key.json');

// Create a new JWT client for the Actions API using credentials from the
// service account key.
let jwtClient = new google.auth.JWT(
  key.client_email,
  null,
  key.private_key,
  ['https://www.googleapis.com/auth/actions.fulfillment.conversation'],
  null
);

// Authorize the client asynchronously, passing in a callback to run
// upon authorization.
jwtClient.authorize((err, tokens) => {
  if (err) {
    console.log(err);
    return;
  }

  // Get the current time in ISO 8601 format.
  const currentTime = new Date().toISOString();

  // Declare the ID of the order to update.
  const actionOrderId = '<UNIQUE_ORDER_ID>';

  // Declare the particular updated state of the order.
  const orderUpdate = new OrderUpdate({
    actionOrderId: actionOrderId,
    orderState: {
      label: 'Order has been delivered!',
      state: 'FULFILLED',
    },
    updateTime: currentTime,
  });

  // Set up the POST request header and body, including the authorized token
  // and order update.
  const bearer = 'Bearer ' + tokens.access_token;
  const options = {
    method: 'POST',
    url: 'https://actions.googleapis.com/v2/conversations:send',
    headers: {
      'Authorization': bearer,
    },
    body: {
      custom_push_message: {
        order_update: orderUpdate,
      },
      // The line below should be removed for non-sandbox transactions.
      is_in_sandbox: true,
    },
    json: true,
  };

  // Send the POST request to the Actions API.
  request.post(options, (err, httpResponse, body) => {
    if (err) {
      console.log(err);
      return;
    }
    console.log(body);
  });
});

Troubleshooting

If you run into any issues during testing, you should read our troubleshooting steps for transactions.