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, only spend-based commitments for selected products 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
Compute Engine flexible commitment 1 year services/compute.googleapis.com/standardOffers/ffe0f6a3-2f98-437e-8d49-fc443a05d3c2
Compute Engine flexible commitment 3 years services/compute.googleapis.com/standardOffers/062a285d-8989-4ce7-8f9a-bed8d183236f
AlloyDB for PostgreSQL 1 year services/alloydb.googleapis.com/standardOffers/adbca020-a973-48c9-b9b6-f5d70527790c
AlloyDB for PostgreSQL 3 years services/alloydb.googleapis.com/standardOffers/56e5948f-f1ed-45ce-84d6-a8408092e7d5
Cloud Bigtable 1 year services/bigtable.googleapis.com/standardOffers/5a0a5567-1552-445e-9f1b-f1ac69fb0f39
Cloud Bigtable 3 years services/bigtable.googleapis.com/standardOffers/26e8485e-acef-4e73-9a13-f0b2109befff
Cloud Run 1 year services/run.googleapis.com/standardOffers/55435965-baf5-485f-baea-3fde53566e5e
Cloud Run 3 years services/run.googleapis.com/standardOffers/a8b22b6c-2992-48d3-9b73-98fc7a47d61c
Cloud Spanner 1 year services/spanner.googleapis.com/standardOffers/29829e5f-681c-4810-a471-8e4611a8042b
Cloud Spanner 3 years services/spanner.googleapis.com/standardOffers/709f6c69-8a49-4032-97f7-ce21fe340603
Cloud SQL 1 year services/cloudsql.googleapis.com/standardOffers/266e6a8c-2a0d-4b92-af9c-5795760f1fc9
Cloud SQL 3 years services/cloudsql.googleapis.com/standardOffers/4998bf0a-51dd-4ce0-8405-aa529dd86d33
Kubernetes Engine 1 year services/container.googleapis.com/standardOffers/ae2672e6-47a8-41dc-9448-6956d7f4fbc1
Kubernetes Engine 3 years services/container.googleapis.com/standardOffers/fcf378c1-fbe0-4aaa-b05e-9597f8b45578
Memorystore 1 year services/redis.googleapis.com/standardOffers/fe93270a-f338-4a76-b303-c323608a9d37
Memorystore 3 years services/redis.googleapis.com/standardOffers/8f20579e-7630-4592-8fa6-0d7d3b749354

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.