Purchase a commitment Offer by using the Cloud Commerce Consumer Procurement API

You can purchase offers by using the Cloud Commerce Consumer Procurement API, an API for making Cloud Marketplace purchases.

Today, the API is in Preview, and only spend-based commitments can be purchased via the API. This how-to describes how to purchase a spend-based commitment.

Before you begin

Identify the Offer you want to purchase

To purchase a spend-based commitment, you use an Offer name which indicates the product you're purchasing and the discount term.

The following Offers are available for purchase:

Product Term Offer name
VMWare Engine 1 year services/vmwareengine.googleapis.com/standardOffers/094acb28-d4fc-49fb-9490-0c469cc7048e
VMWare Engine 3 years services/vmwareengine.googleapis.com/standardOffers/f179581e-c899-4271-9462-9f9e0ed1526c

Identify the Offer parameters

Commitments have two parameters:

  • Commitment amount (hourly_commit): The credit applied to your Cloud Billing account each hour after you purchase this commitment.
  • Region (region): The region for which this commitment's credits apply.

When you purchase a commitment, you must specify both parameters.

Products have specific values and constraints for their parameters. For example, if you want to purchase VMWare Engine, you might refer to the following values and constraints:

Product Minimum commitment Maximum commitment Regions
VMWare Engine $5 per hour $10,000 per hour asia-northeast1
asia-south1
asia-southeast1
australia-southeast1
europe-west2
europe-west3
europe-west4
northamerica-northeast
northamerica-northeast1
southamerica-east1
us-central1
us-east4
us-west2

Purchase the Offer

To purchase an Offer, call billingAccounts.orders.place, and supply the following parameters:

  • The hourly_commit indicating the dollar value of the commitment.

  • The region to purchase the commitment for.

To place an order, run the following command:

curl 'https://cloudcommerceconsumerprocurement.googleapis.com/v1alpha1/billingAccounts/BILLING_ACCOUNT_ID/orders:place' \
    --header 'Content-Type: application/json' \
    --header 'Authorization: Bearer ACCESS_TOKEN' \
    --header 'X-Goog-User-Project: CONSUMER_PROJECT_ID' \
    -d '@-' <<EOF
    {
    "displayName": "DISPLAY_NAME",
    "lineItemInfo": [{
        "parameters": [{
        "name": "hourly_commit",
        "value": {
            "doubleValue": HOURLY_COMMIT
        }
        }, {
        "name": "region",
        "value": {
            "stringValue": "REGION"
        }
        }],
        "offer": "OFFER_NAME"
    }]
    }
EOF

This returns the name of a long-running operation:

{
    "name": "OPERATION_NAME"
}

To verify that the returned long-running operation completed successfully, run the following command:

curl 'https://cloudcommerceconsumerprocurement.googleapis.com/v1alpha1/OPERATION_NAME' \
    --header 'Content-Type: application/json' \
    --header 'Authorization: Bearer ACCESS_TOKEN' \
    --header 'X-Goog-User-Project: CONSUMER_PROJECT_ID'

The long-running operation should complete in less than one second.

View your Order

You can view the current state of a commitment directly in Google Cloud console, or by calling billingAccounts.orders.get. The name field of the created Order specifies the Order name.

cURL

To view an order, run the following command:

curl 'https://cloudcommerceconsumerprocurement.googleapis.com/v1alpha1/ORDER_NAME' \
    --header 'Content-Type: application/json' \
    --header 'Authorization: Bearer ACCESS_TOKEN' \
    --header 'X-Goog-User-Project: CONSUMER_PROJECT_ID'

Console

  1. Navigate to https://console.cloud.google.com/billing.
  2. Select your Cloud Billing account.
  3. Select Commitments from the sidebar.
  4. Your purchased commitment is visible in the displayed table.