Orders API

The Orders API enables merchants to process orders received through the Purchases on Google and
Google Express Merchant Direct programs in Google Shopping. Through this API, participating
merchants can:

Receive and acknowledge new orders

Reflect their progress shipping them

Provide credits or refunds in response to returns or other events

NOTE: This program is only available to select partners while
it’s in Beta mode.

Get started with the Orders API

To use the Orders API:

Enroll your Merchant Center account in either the "Purchases on Google" or
"Google Express Merchant Direct" programs. (This is in addition to your Merchant
Center's enrollment.) Please contact us to ensure that your Google accounts are enrolled.

Agree to the Purchases on Google terms in your Merchant Center account.
To do this, check the checkbox at
Merchant Center > Purchases on Google > Settings.

Configure a new project.
As part of this step, you will download a JSON key file which you may need to edit, as
described in Service account key.
CAUTION: Store the key file securely and keep track of
its location. If you lose it, you cannot download it again, but you can repeat this step to
create a new project and get a new key file.

Assign the order manager role

Before you can use the Orders API, you must assign the role of "Purchases on Google Order
Manager" to your Google Service Account (GSA) and any other accounts that will access the Orders API
or the Orders view in Merchant Center.

If you do not see the Users option in the drop-down list, your account does not have
administrative privileges.

Click a user's row to edit it. The User Preferences view displays.

If an account is not in the user list, click the + icon to add
it.

In the User access section, check the
Purchases on Google Order Manager checkbox, as the following example
shows:

Click the Save button to save your changes.

The Purchases on Google Order Manager role should appear next to the user in the user
list. Repeat this process for all accounts that will access the Orders API or the Orders view
in Merchant Center.

Sandbox and production modes

You can use the Orders API in one of two modes, depending on whether you are building and testing
your implementation in a sandbox, or you are deploying it to a production environment. Sandbox mode
might also be where new API features can first be used.

You indicate which version you want to use in the URL:

https://www.googleapis.com/content/mode/merchant_ID/orders/

Where merchant_ID is your Merchant Center ID and mode specifies which mode
to use:

Production mode ("v2"): For your live order processing, use production mode
by specifying "/v2" for the mode in your URLs. For example:

GET 'https://www.googleapis.com/content/v2/42/orders/'

Sandbox mode ("v2sandbox"): For experimenting and issuing test requests,
use sandbox mode by specifying "/v2sandbox" for the mode in your URLs. For example:

GET 'https://www.googleapis.com/content/v2sandbox/42/orders/'

Sandbox mode supports the following additional methods that production mode does not:

Tutorial: Using the "Try the API" functionality

To quickly create test orders in sandbox mode, use the "Try this API" box on
the right hand side of the createtestorder documentation page. The ability to try the API
functionality works on all of the API documentation pages.

NOTE: To use "Try this API", you must be logged into a Google
account that has been added to Merchant Center and given “Purchases on Google Order Manager” role
privileges, as described in Get started with the Orders API.

Note that "Try this API" calls the method whose documentation you are currently viewing. For
example, if you are viewing the createtestorder reference page, the "Try this API" feature
calls createtestorder. To call get, navigate to the get reference
page.

Enter your merchant ID in the merchantId request parameter field.

Add the templateName field to the request body, and set it to one of the
templates described below (for example, "template1").

The following example shows a simple call with merchant ID "42":

Click the Execute button.

The Orders API creates a new test order and responds with an HTTP 200. The response includes
the order ID of the newly created order, as the following example shows:

Copy the value of orderId from the response. You can use the order's ID in
Next steps.

Next steps

After creating a test order, you can move it through the process of acknowledgement and shipping
while setting its status each step of the way. A common workflow includes the following:

See the contents of the newly created order with the get method. You can also use list
to get a list of all orders.

Order templates

Google provides the following pre-populated order templates that have been created so that you
don’t have to type in all of the details. These can be called using the template parameter in the
createtestorder method: