My favorites | English | Sign in

Google Checkout

Subscriptions (experimental)

Note: This is the latest documentation. The previous version of this page is identical—only the left nav differs.
Overview
Google-Handled Subscriptions
Merchant-Handled Subscriptions
Known Issues

Overview

Subscriptions allow you to charge customers on a regular, recurring basis without additional customer input. There are two types of subscriptions offered by Google Checkout:

  • Google-Handled subscriptions are simple, but powerful. Use Google-Handled subscriptions if you would like to avoid handling the timing of each recurrence yourself, allowing Google to recur the subscription. You provide Google with the information needed to recur the subscription at the time of purchase, and Google takes over from there.
  • Merchant-Handled subscriptions provide maximum flexibility. Use Merchant-Handled subscriptions if you would like finer-grained control over what and when you charge the buyer. Google enforces limits of the subscription, but you may control the specific price, content, and timing of each recurrence.

About this document

This document contains the following information:

  • The Google-Handled Subscriptions section explains how to implement Google-Handled subscriptions and details the changes and additions to the Google Checkout XML schema to support this feature.

  • The Merchant-Handled Subscriptions section explains how to implement Merchant-Handled subscriptions and details the changes and additions to the Google Checkout XML schema to support this feature.

  • The Known Issues section lists the outstanding issues related to this feature.

If you have feedback or questions about this feature, please visit the Google Checkout Beta APIs section of the Google Checkout Merchants Forum

Google-Handled Subscriptions

Google-Handled Subscriptions are simple, but powerful. At a minimum you simply have to specify the item to recur and how often it recurs. You may additionally specify a start date for when charging begins, a number of payment times, and a no-charge-after date to avoid off-by-one issues and guarantee an end point. After the subscription is submitted, you don't need to take any further action.

Demonstration

The following screenshot shows a customer purchasing a subscription for a site hosting membership from you, with the addition of a one-time (non-subscription) decoder ring item.

Screenshot of user purchasing a subscription

The XML for the shopping cart is:

<?xml version="1.0" encoding="UTF-8" ?>
<checkout-shopping-cart xmlns="http://checkout.google.com/schema/2">
<shopping-cart>
<items>
<item>
<item-name>Subscription to My Awesome Site</item-name>
<item-description>Twelve Months of Access to My Awesome Site</item-description>
<unit-price currency="USD">0.00</unit-price>
<quantity>1</quantity>
<merchant-private-item-data>
ABCDEFGHIJKLMNOPQRSTUVWXYZ
</merchant-private-item-data>
<subscription type="google" period ="MONTHLY">
<payments>
<subscription-payment times=12>
<maximum-charge currency="USD">12.00</maximum-charge>
</subscription-payment>
</payments>
<recurrent-item>
<item-name>Usage of My Awesome Website for One Month</item-name>
<item-description>Your flat charge for accessing my website</item-description>
<quantity>1</quantity>
<unit-price currency="USD">12.00</unit-price>
<digital-content>
<display-disposition>OPTIMISTIC</display-disposition>
<url>http://mywebsite.example.com</url>
<description>Head over to the website linked below for pie!</description>
</digital-content>
  </recurrent-item>
</subscription>
<digital-content>
<display-disposition>OPTIMISTIC</display-disposition>
<description>Congratulations! Your subscription is being set up. Feel free to log onto &amp;lt;a href='http://mywebsite.example.com'&amp;gt;mywebsite.example.com&amp;lt;/a&amp;gt; and try it out!</description>
</digital-content>
</item>
<item>
<item-name>Decoder Ring</item-name>
<item-description>One-time charge for the decoder ring you (coincidentally) also ordered from me.</item-description>
<unit-price currency="USD">5.00</unit-price>
<quantity>1</quantity>
</item>
</items>
</shopping-cart>
</checkout-shopping-cart>

You will receive a new order notification like the following, if you are level 2 integrated:

<new-order-notification serial-number="911888847875577-00001-7">
  <timestamp>2009-02-18T20:27:11.410Z</timestamp>
  <buyer-id>123456789012345</buyer-id>
  <shopping-cart>

    <items>
      <item>
        <item-name>Subscription to My Awesome Site</item-name>
        <item-description>Twelve Months of Access to My Awesome Site</item-description>
        <unit-price currency="USD">0.00</unit-price>

        <quantity>1</quantity>
        <merchant-private-item-data>
              ABCDEFGHIJKLMNOPQRSTUVWXYZ
        </merchant-private-item-data>
        <subscription type="google" period ="MONTHLY">
          <payments>

            <subscription-payment times=12>
              <maximum-charge currency="USD">12.00</maximum-charge>
            </subscription-payment>
          </payments>
          <recurrent-item>

            <item-name>Usage of My Awesome Website for One Month</item-name>
            <item-description>Your flat charge for accessing my website</item-description>
            <unit-price currency="USD">12.00</unit-price>
            <quantity>1</quantity>

            <digital-content>
              <display-disposition>OPTIMISTIC</display-disposition>
              <url>http://mywebsite.example.com</url>
              <description>Head over to the website linked below for pie!</description>

            </digital-content>
          </recurrent-item>
        </subscription>
        <digital-content>
          <display-disposition>OPTIMISTIC</display-disposition>

          <description>Congratulations! Your subscription is being set up. Feel free to log onto &lt;a href='http://mywebsite.example.com'&gt;mywebsite.example.com&lt;/a&gt; and try it out!</description>
        </digital-content>
      </item>
      <item>

        <item-name>Decoder Ring</item-name>
        <item-description>One-time charge for the decoder ring you (coincidentally) also ordered from me.</item-description>
        <unit-price currency="USD">5.00</unit-price>
        <quantity>1</quantity>

      </item>
    </items>
  </shopping-cart>
  <order-adjustment>
    <merchant-codes />
    <total-tax currency="USD">0.0</total-tax>

    <adjustment-total currency="USD">0.0</adjustment-total>
  </order-adjustment>
  <order-total currency="USD">5.0</order-total>
  <google-order-number>999999999999999</google-order-number>

  <buyer-shipping-address>
    <email>noreply+buy1@example.com</email>
    <company-name></company-name>
    <contact-name>Andrew Buy 1</contact-name>

    <phone></phone>
    <fax></fax>
    <address1>Andrew Buy 1</address1>
    <address2></address2>

    <structured-name>
      <first-name>Andrew</first-name>
      <last-name>Buy 1</last-name>
    </structured-name>
    <country-code>US</country-code>

    <city>New York</city>
    <region>NY</region>
    <postal-code>10011</postal-code>
  </buyer-shipping-address>

  <buyer-billing-address>
    <email>noreply+buy1@example.com</email>
    <company-name></company-name>
    <contact-name>Andrew Buy 1</contact-name>

    <phone></phone>
    <fax></fax>
    <address1>Andrew Buy 1</address1>
    <address2></address2>

    <structured-name>
      <first-name>Andrew</first-name>
      <last-name>Buy 1</last-name>
    </structured-name>
    <country-code>US</country-code>

    <city>New York</city>
    <region>NY</region>
    <postal-code>10011</postal-code>
  </buyer-billing-address>

  <buyer-marketing-preferences>
    <email-allowed>true</email-allowed>
  </buyer-marketing-preferences>
  <fulfillment-order-state>NEW</fulfillment-order-state>
  <financial-order-state>REVIEWING</financial-order-state>

</new-order-notification>

A month later, a new order between the same customer and you will be created, containing the item specified with "recurrent-item". You must process this order per your normal process; if you've turned on order auto-charging, this means you need only ship it. The customer will see this recurrence by going to the initial order. Here's what they see:


Screenshot of the customer viewing their recurrence order

Based on the initial cart, this will be automatically submitted for 11 more charges, one per month (the reason this isn't 12 is explained later in this document). For each one, including the one which created the receipt page above, you'll receive a New Order Notification (if you are level 2 integrated), like:

<new-order-notification serial-number="556677889911223-00001-7">
  <timestamp>2009-02-19T20:53:12.697Z</timestamp>

  <buyer-id>123456789012345</buyer-id>
  <shopping-cart>
    <items>
    <item>
      <item-name>Usage of My Awesome Website for May</item-name>

      <item-description>
        You read 11 $1 articles on my website. Hope you enjoyed them, and see you next month!
      </item-description>
      <unit-price currency="USD">11.00</unit-price>
      <quantity>1</quantity>

      <digital-content>
        <display-disposition>OPTIMISTIC</display-disposition>
        <url>http://mywebsite.example.com</url>
        <description>Head over to the website linked below for pie!</description>

      </digital-content>
    </item>
  </items>
  </shopping-cart>
  <order-adjustment>
    <merchant-codes />

    <total-tax currency="USD">0.0</total-tax>
    <adjustment-total currency="USD">0.0</adjustment-total>
  </order-adjustment>
  <order-total currency="USD">0.01</order-total>

  <google-order-number>556677889911223</google-order-number>
  <buyer-shipping-address>
    <email>noreply+buy1@example.com</email>
    <company-name></company-name>

    <contact-name>Andrew Buy 1</contact-name>
    <phone></phone>
    <fax></fax>
    <address1>Andrew Buy 1</address1>

    <address2></address2>
    <structured-name>
      <first-name>Andrew</first-name>
      <last-name>Buy 1</last-name>

    </structured-name>
    <country-code>US</country-code>
    <city>New York</city>
    <region>NY</region>

    <postal-code>10011</postal-code>
  </buyer-shipping-address>
  <buyer-billing-address>
    <email>noreply+buy1@example.com</email>
    <company-name></company-name>

    <contact-name>Andrew Buy 1</contact-name>
    <phone></phone>
    <fax></fax>
    <address1>Andrew Buy 1</address1>

    <address2></address2>
    <structured-name>
      <first-name>Andrew</first-name>
      <last-name>Buy 1</last-name>

    </structured-name>
    <country-code>US</country-code>
    <city>New York</city>
    <region>NY</region>

    <postal-code>10011</postal-code>
  </buyer-billing-address>
  <buyer-marketing-preferences>
    <email-allowed>true</email-allowed>
  </buyer-marketing-preferences>

  <fulfillment-order-state>NEW</fulfillment-order-state>
  <financial-order-state>REVIEWING</financial-order-state>
</new-order-notification>

You then have to change the state of the new order in the normal way, charging if auto-charge is not enabled, and delivering the order.

Submitting an Order with a Subscription

The following XML excerpt shows how an item that is a subscription appears in a Checkout API request. XML tags that are used for subscriptions are shown in bold text. The subscription specifies that the item is a year-long subscription that has a monthly cost of $12.99. The XML also specifies that the customer's first recurrence period starts on April 1, 2008. As shown by the presence of the second item in the XML, orders that contain subscription items can also contain non-subscription items. A non-subscription item is just a regular item. For example, the user could buy a newspaper subscription, a t-shirt, and a teddy bear. The non-subscription items behave as they would in any other cart, and do not participate in any recurrences.

<item>
<item-name>Bronze-level site hosting membership</item-name>
<item-description>30GB of disk space.</item-description>
<quantity>1</quantity>
<unit-price currency="USD">0</unit-price>
<subscription type="google" period="MONTHLY"
start-date="2008-04-01T07:55:55.952-08:00"
no-charge-after="2009-03-31T07:55:55.952-08:00">
<payments>
<subscription-payment times="12">
<maximum-charge currency="USD">12.99</maximum-charge>
</subscription-payment>
</payments>
<recurrent-item>
<item-name>Usage of My Awesome Website for One Month</item-name>
<item-description>Your flat charge for accessing my website</item-description>
<quantity>1</quantity>
<unit-price currency="USD">12.00</unit-price>
<digital-content>
<display-disposition>OPTIMISTIC</display-disposition>
<url>http://mywebsite.example.com</url>
<description>Head over to the website linked below for pie!</description>
</digital-content>
</recurrent-item>
</subscription>
</item>
<item>
<item-name>Additional domain name</item-name>
<item-description>Register an additional domain for $0.99</item-description>
<quantity>1</quantity>
<unit-price currency="USD">0.99</unit-price>
</item>

The following list explains the bold tags that appear in the sample XML:

  • The <subscription> tag specifies that the item is a subscription that will be charged on a recurring basis. This tag identifies the starting date for the subscription as well as the length of the recurrence period. This tag contains information about the recurring charges associated with the subscription.

    The "start-date" attribute can be unspecified. If so, the start-date is the when the user checks out. This is probably the most useful, as it allows the subscription to be included in a Buy Button. If the start-date is set, the start-date can have any time in the future. This will determine when the first charge is issued: if the start date is set, then the first charge will be issued at some point after that time; if unset, one period after the time at which the customer purchases the subscription. This is to remove any confusion with in-cart items also carrying a cost. If you wish to charge at the beginning of a recurrence period, and you set the start-date to be today, the customer may have the confusing situation of checking out a cart with no charges in it, then unexpectedly paying more the same day. For more information about this, see the recommendations section.

  • The <payments> tag, which is a subtag of <subscription>, encapsulates a list of one or more payment schedules associated with the subscription. Please note that we currently support only one payment schedule per subscription.

  • The <subscription-payment> tag, which is a subtag of <payments>, contains information about an individual recurring charge associated with a subscription. You have the option of specifying that a subscription will not continue indefinitely by indicating the maximum number of times that you will charge.

  • The <maximum-charge> tag, which is a subtag of <subscription-payment>, specifies the maximum amount that the customer can be charged. If you do not charge tax, this number should be the same as the unit-price of the recurrent-item (see below); if you do, it should be a close estimate greater than the total cost you expect each recurrence charge to have. This number will be displayed on the buy page.

  • The <unit-price> tag, which is a subtag of <item>, is used for all items, including the top level subscription item you see here. However, this tag behaves differently for a subscription item than for an ordinary non-subscription item (as previously described). For subscription items, this must be zero. If not, there will be an error at cart posting time. Because the unit-price will always be zero, the customer is not charged for the subscription item at checkout time. To include a signup fee, include an extra item with the appropriate unit-price.

    To immediately charge the user for the first month's subscription, create an item that represents that first month's subscription. The customer will pay when they buy the subscription. In this case, you should not set the "start-date" of the subscription. Be aware that the "times" attribute of the <subscription-payment> tag will represent the amount of times including the initial time, since the initial charges were part of the first recurrence.

  • The <recurrent-item> tag, which is a subtag of <subscription>, specifies the item which Google should send, on your behalf, whenever it is time to issue a recurrence. It does this as soon as it is possible, which may not be the exact time you specify. The item is sent as documented in the Merchant-Handled documentation, without specifying any explicit tax or shipping information. This behaves exactly like the <item> tag carts may normally contain within the <items> element of the <shopping-cart>; it should have the name you'd like the customer to see each month, the description, and the appropriate unit-price and quantity. Note that even in the absence of taxes or shipping, this <recurrent-item>'s unit-price multiplied by its quantity must be less than the subscription's maximum charge as specified above.

The following table shows the different options available, using an example of a magazine subscription that cost $10 per month, and lasts for 12 months. It shows the following columns:

  • Example: The different customer experiences we are creating.
  • Non-subscription item's unit-price: The price of an extra non-subscription item in the cart the user purchases. A $0 value can mean the same as no extra item at all.
  • maximum-charge: The "maximum-charge" attribute of the subscription-payment tag, in this case the absolute charge since for a magazine subscription all charges are equal.
  • payment times: The "times" attribute of the payments tag.
  • start-date: The start-date attribute of the subscription-payment tag.
  • Date of first Google-issued recurrence: The date at which Google will first take action, creating an order with no merchant or customer interaction.
  • On checkout, customer pays: The amount that the customer will pay when purchasing the subscription. Note that in some cases, the customer pays the same day, but not on the cart.
The rows are different scenarios. For example, the first row shows a magazine subscription in which the user pays at the end of the recurrence period.
Example Non-subscription item's unit-price maximum-charge payment times start-date Date of first Google-issued recurrence
On checkout, customer pays:
Payments happen at end of recurrence period $0 $10 13 unused 1 month from now $0
Payments happen at end of recurrence period, plus there is a $5 sign-up fee $5 $10 13 unused 1 month from now $5
Payments happen at start of recurrence period, extra item method $10 $10 12 unused now $10
Payments happen at start of recurrence period, start-date method $0 $10 12 now now $0


Canceling A Subscription

A customer can cancel a subscription by viewing the receipt page for the initial subscription order, then clicking the Cancel Subscription link. If you're level 2 integrated, you will receive a cancelled-subscription-notification like the following :

<?xml version="1.0" encoding="UTF-8"?>
<cancelled-subscription-notification xmlns="http://checkout.google.com/schema/2" serial-number="968116944582449-00014-9">
  <item-ids />
  <google-order-number>968116944582449</google-order-number>
  <reason>Customer request to cancel</reason>
  <timestamp>2009-10-15T23:51:04.662Z</timestamp>
</cancelled-subscription-notification>

Merchant cancelled Subscription

To cancel a subscription as a merchant using our API to submit a <cancel-items> request for the specific subscription item in the cart. The documentation for this command can be found here.

XML Tag Definitions



Certain symbols may be displayed next to some subtags in the definitions below. These symbols, and their meanings, are:

? = optional subtag
* = zero or more instances of the subtag
Checkout API Request Tags
subscription
Definition

The <subscription> tag indicates that an item in an order is a subscription. If this tag is included, then the unit price for the item must be 0. (You will use the <subscription-payment> tag to identify the charges for the subscription.)

Attributes
Name Format Description
no-charge-after Date Optional. The no-charge-after attribute specifies the latest date and time that you can charge the customer for the subscription. This element can help you to ensure that you do not overcharge your customers.
period String Required. The period attribute specifies how frequently you will charge the customer for the subscription. Valid values for this attribute are DAILY, WEEKLY, SEMI_MONTHLY, MONTHLY, EVERY_TWO_MONTHS, QUARTERLY, and YEARLY.
start-date Date Optional. The start-date attribute specifies the date that the subscription's recurrence period will begin. Like all dates in Checkout, this is in ISO 8601 format. If you set the <unit-price> tag's value to a nonzero value, then the start-date for the subscription will automatically be set to the time that is exactly one recurrence period after the order is placed.
type String Required. The type attribute identifies the type of subscription that you are creating. The valid values for this attribute are merchant and google, and this specifies who handles the recurrences. The merchant value specifies Merchant-Handled recurrences, and the google value specifies Google-Handled recurrences.
Subtag of item
Subtags payments
Content Format Container
Example Monthly Merchant-Handled subscription, starting at July 1, 2009, 9:00 am PDT, and ensuring no charges take place after one year:
<subscription type="merchant" period="MONTHLY" start-date="2009-07-01T09:00:00-08:00" no-charge-after="2010-07-01T09:00:00-08:00">
...
</subscription>
Yearly Merchant-Handled subscription, able to start either when the user checks out or we first submit a recurrence charge. No limits on how long we can charge for:
<subscription type="merchant" period="YEARLY" type="merchant">
...
</subscription>

payments
Definition

The <payments> tag encapsulates information about the charges for a subscription, including the number of times each payment can be charged.

Subtag of subscription
Subtags subscription-payment*
Content Format Container

subscription-payment
Definition

The <subscription-payment> tag contains information about a charge associated with a subscription.

Attributes
Name Format Description
times Integer Optional. The times attribute indicates how many times you will charge the customer for a defined subscription payment. A subscription may have multiple payment schedules, and the times attribute lets you indicate how many times each charge will be assessed. For example, you might charge the customer a reduced rate for the first three months of a subscription and then charge the standard rate each month thereafter.
Subtag of payments
Subtags maximum-charge
Content Format Complex
Example Recur forever, or until the no-charge-after date (set on the subscription):
<subscription-payment>
...
</subscription-payment>
Recur 50 times, or until the no-charge-after date (set on the subscription):
<subscription-payment times=50>
...
</subscription-payment>

maximum-charge
Definition

The <maximum-charge> tag specifies the maximum amount that you will be allowed to charge the customer, including tax, for all recurrences.

Attributes
Name Format Description
currency String Required. The currency attribute identifies the unit of currency associated with the tag's value. The value of the currency attribute must be a three-letter ISO 4217 currency code.
Subtag of subscription-payment
Content Format Decimal
Example
<maximum-charge currency="USD">12.99</maximum-charge>

recurrent-item
Definition

The <recurrent-item> tag specifies the item that will recur on each recurrence period. This item will effectively be placed in a new cart each period which the customer automatically purchases.

Subtag of subscription
Content Format See the item tag documentation.
Example
<recurrent-item>
<item-name>Usage of My Awesome Website for One Month</item-name>
<item-description>Your flat charge for accessing my website</item-description>
<quantity>1</quantity>
<unit-price currency="USD">12.00</unit-price>
<digital-content>
<display-disposition>OPTIMISTIC</display-disposition>
<url>http://mywebsite.example.com</url>
<description>Head over to the website linked below for pie!</description>
</digital-content>
</recurrent-item>

cancelled-subscription-notification
Definition

The <cancelled-subscription-notification> tag contains information about the cancellation of a subscription, including the item-ids, google order number, reason, and timestamp.

Attributes
Name Format Description
serial-number String The serial-number attribute contains an ID that uniquely identifies a Google Checkout notification.
Subtags item-ids , reason , timestamp
Content Format Container
Example
<?xml version="1.0" encoding="UTF-8"?>
<cancelled-subscription-notification xmlns="http://checkout.google.com/schema/2" serial-number="968116944582449-00014-9">
  <item-ids />
  <google-order-number>968116944582449</google-order-number>
  <reason>Customer request to cancel</reason>
  <timestamp>2009-10-15T23:51:04.662Z</timestamp>
</cancelled-subscription-notification>

XML Schema Changes

This section identifies the changes that will be made to the publicly available Google Checkout XML schema to enable support for subscriptions.

Updated Element Definitions

To enable support for subscriptions, the <item> tag has been updated. The <item> tag now has a new subtag, <subscription> , that contains information about the subscription, such as the start date of the subscription and the payment schedule.

<xs:complexType name="Item">
<xs:all>
<xs:element name="digital-content" type="tns:DigitalContent" minOccurs="0" />
<xs:element name="item-description" type="xs:string" />
<xs:element name="item-name" type="xs:string" />
<xs:element name="item-weight" type="tns:ItemWeight" minOccurs="0" />
<xs:element name="merchant-item-id" type="xs:string" minOccurs="0" />
<xs:element name="merchant-private-item-data"
type="tns:anyMultiple" minOccurs="0" />
<xs:element name="quantity">
<xs:simpleType>
<xs:restriction base="xs:int">
<xs:minInclusive value="1" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="subscription" type="tns:Subscription" minOccurs="0" />
<xs:element name="tax-table-selector" minOccurs="0">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:minLength value="0" />
<xs:maxLength value="255" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="unit-price" type="tns:Money" />
</xs:all>
</xs:complexType>
<xs:complexType name="NotificationDataResponse"> <xs:all> <xs:element name="continue-token" type="xs:string" minOccurs="0" /> <xs:element name="has-more-notifications" type="xs:boolean" minOccurs="0" /> <xs:element name="notifications"> <xs:complexType> <xs:sequence> <xs:choice minOccurs="0" maxOccurs="unbounded"> <xs:element name="authorization-amount-notification" type="tns:AuthorizationAmountNotification" /> <xs:element name="cancelled-subscription-notification" type="tns:CancelledSubscriptionNotification" /> <xs:element name="charge-amount-notification" type="tns:ChargeAmountNotification" /> <xs:element name="chargeback-amount-notification" type="tns:ChargebackAmountNotification" /> <xs:element name="new-order-notification" type="tns:NewOrderNotification" /> <xs:element name="order-state-change-notification" type="tns:OrderStateChangeNotification" /> <xs:element name="refund-amount-notification" type="tns:RefundAmountNotification" /> <xs:element name="risk-information-notification" type="tns:RiskInformationNotification" /> <xs:element name="merchant-status-change-notification" type="tns:MerchantStatusChangeNotification" /> </xs:choice> </xs:sequence> </xs:complexType> </xs:element> </xs:all> <xs:attribute name="serial-number" type="xs:string" use="required" /> </xs:complexType>

Newly Added Elements

The following elements have been added to the Checkout schema for the subscriptions feature.

<xs:complexType name="Subscription">
<xs:all>
<xs:element name="payments">
<xs:complexType>
<xs:sequence>
<xs:element name="subscription-payment" type="tns:SubscriptionPayment"
minOccurs="0" maxOccurs="unbounded" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:all>
<xs:attribute name="no-charge-after" type="xs:dateTime" use="optional" />
<xs:attribute name="period" type="tns:DatePeriod" use="required" />
<xs:attribute name="start-date" type="xs:dateTime" use="required" />
<xs:attribute name="type" type="xs:string" use="required" />
</xs:complexType>

<xs:complexType name="SubscriptionPayment">
<xs:all>
<xs:element name="maximum-charge" type="tns:Money" />
</xs:all>
<xs:attribute name="times" type="xs:int" use="optional" />
</xs:complexType>

<xs:simpleType name="DatePeriod">
<xs:restriction base="xs:token">
<xs:enumeration value="DAILY" />
<xs:enumeration value="WEEKLY" />
<xs:enumeration value="SEMI_MONTHLY" />
<xs:enumeration value="MONTHLY" />
<xs:enumeration value="EVERY_TWO_MONTHS" />
<xs:enumeration value="QUARTERLY" />
<xs:enumeration value="YEARLY" />
</xs:restriction>
</xs:simpleType>

<xs:element name="recurrent-item" type="tns:Item" minOccurs="0" />
<xs:complexType name="CancelledSubscriptionNotification"> <xs:all> <xs:element name="google-order-number" type="xs:token" /> <xs:element name="item-ids"> <xs:complexType> <xs:sequence> <xs:element name="item-id" type="tns:ItemId" minOccurs="0" maxOccurs="unbounded" /> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="reason" type="xs:string" minOccurs="0" /> <xs:element name="timestamp" type="xs:dateTime" /> </xs:all> <xs:attribute name="serial-number" type="xs:string" use="required" /> </xs:complexType>

HTML API Example

This example shows the HTML API shopping cart post for a subscription for membership to a website, with the addition of a one-time (non-subscription) decoder ring item. Be sure to replace MERCHANT_ID with your own merchant ID.

The HTML for the shopping cart is:

<form method="POST" action="https://checkout.google.com/api/checkout/v2/checkoutForm/Merchant/MERCHANT_ID" accept-charset="utf-8">
<input type="hidden" name="shopping-cart.items.item-1.item-name" value="Subscription to My Awesome Site"/>
<input type="hidden" name="shopping-cart.items.item-1.item-description" value="Twelve Months of Access to My Awesome Site"/>
<input type="hidden" name="shopping-cart.items.item-1.unit-price.currency" value="USD"/>
<input type="hidden" name="shopping-cart.items.item-1.unit-price" value="0.00"/>
<input type="hidden" name="shopping-cart.items.item-1.quantity" value="1"/>
<input type="hidden" name="shopping-cart.items.item-1.subscription.type" value="google"/>
<input type="hidden" name="shopping-cart.items.item-1.subscription.period" value="MONTHLY"/>
<input type="hidden" name="shopping-cart.items.item-1.subscription.payments.subscription-payment-1.times" value="12">
<input type="hidden" name="shopping-cart.items.item-1.subscription.payments.subscription-payment-1.maximum-charge" value="12.00">
<input type="hidden" name="shopping-cart.items.item-1.subscription.payments.subscription-payment-1.maximum-charge.currency" value="USD">
<input type="hidden" name="shopping-cart.items.item-1.subscription.recurrent-item.item-name" value="Usage of My Awesome Website for One Month">
<input type="hidden" name="shopping-cart.items.item-1.subscription.recurrent-item.item-description" value="Your flat charge for accessing my website">
<input type="hidden" name="shopping-cart.items.item-1.subscription.recurrent-item.quantity" value="1">
<input type="hidden" name="shopping-cart.items.item-1.subscription.recurrent-item.unit-price" value="12.00">
<input type="hidden" name="shopping-cart.items.item-1.subscription.recurrent-item.unit-price.currency" value="USD">
<input type="hidden" name="shopping-cart.items.item-1.subscription.recurrent-item.digital-content.display-disposition" value="OPTIMISTIC">
<input type="hidden" name="shopping-cart.items.item-1.subscription.recurrent-item.digital-content.url" value="http://mywebsite.example.com">
<input type="hidden" name="shopping-cart.items.item-1.subscription.recurrent-item.digital-content.description" value="Head over to the website linked below for pie!">
<input type="hidden" name="shopping-cart.items.item-1.digital-content.display-disposition" value="OPTIMISTIC">
<input type="hidden" name="shopping-cart.items.item-1.digital-content.description" value="Congratulations! Your subscription is being set up. Feel free to log onto &lt;a href='http://mywebsite.example.com'&gt;mywebsite.example.com&lt;/a&gt;and try it out!">
<input type="hidden" name="shopping-cart.items.item-2.item-name" value="Decoder Ring">
<input type="hidden" name="shopping-cart.items.item-2.item-description" value="One-time charge for the decoder ring you (coincidentally) also ordered from me.">
<input type="hidden" name="shopping-cart.items.item-2.unit-price" value="5.00">
<input type="hidden" name="shopping-cart.items.item-2.unit-price.currency" value="USD">
<input type="hidden" name="shopping-cart.items.item-2.quantity" value="1">
<input type="hidden" name="_charset_"/>
<input type="image" name="Google Checkout" alt="Fast checkout through Google" src="http://checkout.google.com/buttons/checkout.gif?merchant_id=MERCHANT_ID&w=180&h=46&style=white&variant=text&loc=en_US" height="46" width="180"/>
</form>

Merchant-Handled Subscriptions

Merchant-Handled subscriptions are quite flexible. To give several examples, a year-long subscription could be charged monthly with equal payments, the initial payment could be discounted, or the first three payments could be in smaller amounts. Alternatively, the subscription can be put on hold until you want to start charging. You can set a unit price for a charge, a maximum charge to ensure to the customer that there is a limit on what they may pay. You can set a start date for when charging begins, a number of payment times, and a no-charge-after date to guarantee an end point.

Demonstration

The following screenshot shows what the cart looks like to a customer purchasing a subscription for a site hosting membership for a subscription to a website, with the addition of a one-time (non-subscription) decoder ring item.

Screenshot of user purchasing a subscription

The XML for the shopping cart is:

<?xml version="1.0" encoding="UTF-8" ?>
<checkout-shopping-cart xmlns="http://checkout.google.com/schema/2">
  <shopping-cart>

    <items>
      <item>
        <item-name>Subscription to My Awesome Site</item-name>
        <item-description>Twelve Months of Access to My Awesome Site</item-description>
        <unit-price currency="USD">0.00</unit-price>

        <quantity>1</quantity>
        <merchant-private-item-data>
         ABCDEFGHIJKLMNOPQRSTUVWXYZ
        </merchant-private-item-data>
        <subscription type="merchant" period ="MONTHLY">
          <payments>

            <subscription-payment>
              <maximum-charge currency="USD">12.00</maximum-charge>
            </subscription-payment>
          </payments>
        </subscription>

        <digital-content>
          <display-disposition>OPTIMISTIC</display-disposition>
          <description>Congratulations! Your subscription is being set up. Feel free to log onto &amp;lt;a href='http://mywebsite.example.com'&amp;gt;mywebsite.example.com&amp;lt;/a&amp;gt; and try it out!</description>

        </digital-content>
      </item>
      <item>
        <item-name>Decoder Ring</item-name>
        <item-description>One-time charge for the decoder ring you (coincidentally) also ordered from me.</item-description>

        <unit-price currency="USD">5.00</unit-price>
        <quantity>1</quantity>
      </item>
    </items>
  </shopping-cart>

</checkout-shopping-cart>

You will receive a new order notification like the following, if you are level 2 integrated:

<new-order-notification serial-number="1234567890-00001-7">
  <timestamp>2009-02-18T20:27:11.410Z</timestamp>
  <buyer-id>123456789012345</buyer-id>

  <shopping-cart>
    <items>
      <item>
        <item-name>Subscription to My Awesome Site</item-name>
        <item-description>Twelve Months of Access to My Awesome Site</item-description>

        <unit-price currency="USD">0.00</unit-price>
        <quantity>1</quantity>
        <merchant-private-item-data>
              ABCDEFGHIJKLMNOPQRSTUVWXYZ
        </merchant-private-item-data>

        <subscription type="merchant" period ="MONTHLY">
          <payments>
            <subscription-payment>
              <maximum-charge currency="USD">12.00</maximum-charge>
            </subscription-payment>

          </payments>
        </subscription>
        <digital-content>
          <display-disposition>OPTIMISTIC</display-disposition>
          <description>Congratulations! Your subscription is being set up. Feel free to log onto &lt;a href='http://mywebsite.example.com'&gt;mywebsite.example.com&lt;/a&gt; and try it out!</description>

        </digital-content>
      </item>
      <item>
        <item-name>Decoder Ring</item-name>
        <item-description>One-time charge for the decoder ring you (coincidentally) also ordered from me.</item-description>

        <unit-price currency="USD">5.00</unit-price>
        <quantity>1</quantity>
      </item>
    </items>
  </shopping-cart>

  <order-adjustment>
    <merchant-codes />
    <total-tax currency="USD">0.0</total-tax>
    <adjustment-total currency="USD">0.0</adjustment-total>
  </order-adjustment>

  <order-total currency="USD">5.0</order-total>
  <google-order-number>1234567890</google-order-number>
  <buyer-shipping-address>
    <email>noreply+buy1@example.com</email>

    <company-name></company-name>
    <contact-name>Andrew Buy 1</contact-name>
    <phone></phone>
    <fax></fax>

    <address1>Andrew Buy 1</address1>
    <address2></address2>
    <structured-name>
      <first-name>Andrew</first-name>

      <last-name>Buy 1</last-name>
    </structured-name>
    <country-code>US</country-code>Thisis
    <city>New York</city>

    <region>NY</region>
    <postal-code>10011</postal-code>
  </buyer-shipping-address>
  <buyer-billing-address>
    <email>noreply+buy1@example.com</email>

    <company-name></company-name>
    <contact-name>Andrew Buy 1</contact-name>
    <phone></phone>
    <fax></fax>

    <address1>Andrew Buy 1</address1>
    <address2></address2>
    <structured-name>
      <first-name>Andrew</first-name>

      <last-name>Buy 1</last-name>
    </structured-name>
    <country-code>US</country-code>
    <city>New York</city>

    <region>NY</region>
    <postal-code>10011</postal-code>
  </buyer-billing-address>
  <buyer-marketing-preferences>
    <email-allowed>true</email-allowed>

  </buyer-marketing-preferences>
  <fulfillment-order-state>NEW</fulfillment-order-state>
  <financial-order-state>REVIEWING</financial-order-state>
</new-order-notification>

This is a normal order, and must be handled per your normal flow, including charging and shipping any non-subscription items. You should also mark the subscription item as shipped to acknowledge your receipt of it.

A month later, the customer can be charged for an amount up to $12. In this example, you want to charge $11 for this month's usage. You submit the following recurrence request:

<?xml version="1.0" encoding="UTF-8"?>
<create-order-recurrence-request google-order-number="1234567890" xmlns="http://checkout.google.com/schema/2">
  <shopping-cart>
    <items>
      <item>

        <item-name>Usage of My Awesome Website for May</item-name>
        <item-description>
          You read 11 $1 articles on my website. Hope you enjoyed them, and see you nextmonth!
        </item-description>
        <unit-price currency="USD">11.00</unit-price>

        <quantity>1</quantity>
        <digital-content>
          <display-disposition>OPTIMISTIC</display-disposition>
          <url>http://mywebsite.example.com</url>

          <description>Head over to the website linked below for pie!</description>
        </digital-content>
      </item>
    </items>
  </shopping-cart>

</create-order-recurrence-request>

The customer will see this recurrence by going to the initial order. Here's the receipt they see:


Screenshot of the customer viewing their recurrence order

Based on the cart, you will be able to submit 11 more charges. From the charge you just made, you will get a new order notification that looks like the following if you are Level 2 integrated:

<new-order-notification serial-number="556677889911223-00001-7">
  <timestamp>2009-02-19T20:53:12.697Z</timestamp>

  <buyer-id>123456789012345</buyer-id>
  <shopping-cart>
    <items>
    <item>
      <item-name>Usage of My Awesome Website for May</item-name>

      <item-description>
        You read 11 $1 articles on my website. Hope you enjoyed them, and see you nextmonth!
      </item-description>
      <unit-price currency="USD">11.00</unit-price>
      <quantity>1</quantity>

      <digital-content>
        <display-disposition>OPTIMISTIC</display-disposition>
        <url>http://mywebsite.example.com</url>
        <description>Head over to the website linked below for pie!</description>

      </digital-content>
    </item>
  </items>
  </shopping-cart>
  <order-adjustment>
    <merchant-codes />

    <total-tax currency="USD">0.0</total-tax>
    <adjustment-total currency="USD">0.0</adjustment-total>
  </order-adjustment>
  <order-total currency="USD">0.01</order-total>

  <google-order-number>556677889911223</google-order-number>
  <buyer-shipping-address>
    <email>noreply+buy1@example.com</email>
    <company-name></company-name>

    <contact-name>Andrew Buy 1</contact-name>
    <phone></phone>
    <fax></fax>
    <address1>Andrew Buy 1</address1>

    <address2></address2>
    <structured-name>
      <first-name>Andrew</first-name>
      <last-name>Buy 1</last-name>

    </structured-name>
    <country-code>US</country-code>
    <city>New York</city>
    <region>NY</region>

    <postal-code>10011</postal-code>
  </buyer-shipping-address>
  <buyer-billing-address>
    <email>noreply+buy1@example.com</email>
    <company-name></company-name>

    <contact-name>Andrew Buy 1</contact-name>
    <phone></phone>
    <fax></fax>
    <address1>Andrew Buy 1</address1>

    <address2></address2>
    <structured-name>
      <first-name>Andrew</first-name>
      <last-name>Buy 1</last-name>

    </structured-name>
    <country-code>US</country-code>
    <city>New York</city>
    <region>NY</region>

    <postal-code>10011</postal-code>
  </buyer-billing-address>
  <buyer-marketing-preferences>
    <email-allowed>true</email-allowed>
  </buyer-marketing-preferences>

  <fulfillment-order-state>NEW</fulfillment-order-state>
  <financial-order-state>REVIEWING</financial-order-state>
</new-order-notification>

You then have to change the state of the new order in the normal way, charging if auto-charge is not enabled, and delivering the order.

Submitting an Order with a Subscription

The following XML excerpt shows how an item that is a subscription appears in a Checkout API request. XML tags that are used for subscriptions are shown in bold text. The subscription specifies that the item is a year-long subscription that has a monthly cost of $12.99. The XML also specifies that the customer's first recurrence period starts on April 1, 2008. As shown by the presence of the second item in the XML, orders that contain subscription items can also contain non-subscription items. A non-subscription item is just a regular item. For example, the user could buy a newspaper subscription, a t-shirt, and a teddy bear. The non-subscription items behave as they would in any other cart, and do not participate in any recurrences.

<item>
  <item-name>Bronze-level site hosting membership</item-name>
  <item-description>30GB of disk space.</item-description>

  <quantity>1</quantity>
  <unit-price currency="USD">0</unit-price>
  <subscription type="merchant" period="MONTHLY"
    start-date="2008-04-01T07:55:55.952-08:00"
    no-charge-after="2009-03-31T07:55:55.952-08:00">
    <payments>

      <subscription-payment times="12">
        <maximum-charge currency="USD">12.99</maximum-charge>
      </subscription-payment>
    </payments>

  </subscription>
</item>
<item>
  <item-name>Additional domain name</item-name>
  <item-description>Register an additional domain for $0.99</item-description>

  <quantity>1</quantity>
  <unit-price currency="USD">0.99</unit-price>
</item>

The following list explains the bold tags that appear in the sample XML:

  • The <subscription> tag specifies that the item is a subscription that will be charged on a recurring basis. This tag identifies the starting date for the subscription as well as the length of the recurrence period. This tag contains information about the recurring charges associated with the subscription.

    The "start-date" attribute can be unspecified. If so, the start-date is the when the user checks out. If the start-date is set, the start-date can have any time in the future. The difference between having a start-date unspecified and setting it to today will change how the first recurrence period is charged - either in the cart, or via the same create-order-recurrence-request command that the rest of the recurrences use. From your point of view, handling all recurrences in a consistent manner is beneficial. But if you wish to charge at the beginning of a recurrence period, and you set the start-date to be today, the customer may have the confusing situation of checking out a cart with no charges in it, then unexpectedly paying more the same day. For more information about this, see the recommendations section.

  • The <payments> tag, which is a subtag of <subscription>, encapsulates a list of one or more payment schedules associated with the subscription. Please note that we currently support only one payment schedule per subscription.

  • The <subscription-payment> tag, which is a subtag of <payments>, contains information about an individual recurring charge associated with a subscription. You have the option of specifying that a subscription will not continue indefinitely by indicating the maximum number of times that you will charge..

  • The <maximum-charge> tag, which is a subtag of <subscription-payment>, specifies the maximum amount that you will be allowed to charge the customer on each individual charge.

  • The <unit-price> tag, which is a subtag of <item>, is used for all items, including subscription items. However, this tag behaves differently for a subscription item than for an ordinary non-subscription item (as previously described). For subscription items, this must be zero. If not, there will be an error at cart posting time. Because the unit-price will always be zero, the customer is not charged for the subscription item at checkout time. To include a signup fee, include an extra item with the appropriate unit-price.

    There are two ways to immediately charge the user for the first month's subscription. One is to create an item that represents that first month's subscription. The customer will pay when they buy the subscription. In this case, you should not set the "start-date" of the subscription. Be aware that the "times" attribute of the <subscription-payment> tag will represent the amount of times including the initial time, because the initial charges were part of the first recurrence. The other way to charge the user for the first month's subscription is to charge the first recurrence period immediately as a proper recurrence period. If you do this, it counts against the amount of times the recurrence can be charged. You can set a start-date in the near future, and start the first recurrence then. Then, the customer doesn't pay when they check out, but instead will pay as part of the first recurrence which in this case will start shortly.

The following table shows the different options available, using an example of a magazine subscription that cost $10 per month, and lasts for 12 months. It shows the following columns:

  • Example: The different customer experiences we are creating.
  • Non-subscription item's unit-price: The price of an extra non-subscription item in the cart the user purchases. A $0 value can mean the same as no extra item at all.
  • maximum-charge: The "maximum-charge" attribute of the subscription-payment tag, in this case the absolute charge since for a magazine subscription all charges are equal.
  • payment times: The "times" attribute of the payments tag.
  • start-date: The start-date attribute of the subscription-payment tag.
  • Date of first create-order-recurrence-request: The create-order-recurrence-request command. This is the first time the merchant should send this command.
  • On checkout, customer pays: The amount that the customer will pay when purchasing the subscription. Note that in some cases, the customer pays the same day, but not on the cart.
The rows are different scenarios. For example, the first row shows a magazine subscription in which the user pays at the end of the recurrence period.

ExampleNon-subscription item's unit-pricemaximum-chargepayment timesstart-dateDate of first create-order-recurrence-requestOn checkout, customer pays:
Payments happen at end of recurrence period$0$1013unused1 month from now$0
Payments happen at end of recurrence period, plus there is a $5 sign-up fee$5$1013unused1 month from now$5
Payments happen at start of recurrence period, extra item method$10$1012unusednow$10
Payments happen at start of recurrence period, start-date method$0$1012nownow$0

Recommendations

  • If you wish to charge at the end of the recurrence period:
    • If the subscription starts now, omit the subscription's start-date, otherwise set the start-date attribute to the actual start of the subscription, and charge at the end of the recurrence period.
    • Do not include any other items in the cart if possible, unless there is a signup fee, in which case include that as an extra item.
    • If this is a finite subscription, set the "times" attribute of the <payments> tags be one more than the number actual periods. For example, if it's a one-year magazine subscription, with monthly recurrence periods, then "times" should be 13, not 12, because the first recurrence period is a free one
    • Be aware that the customer can get their last period for free, because the customer can cancel at any time before the end of the recurrence period.
  • If you wish to charge at the beginning of the recurrence period:
    • If the subscription starts immediately, do not set start-date and add an item representing the first period's charges to the cart. This is the solution most friendly to customers.
    • If the subscription starts later than now, set the start-date to the start of the recurrence period.
  • We strongly recommend making the subscription item digital, so that it does not need to ship. Otherwise, you will need to ship the subscription, after charging it, and the buyer will receive mail about this. This mail is bound to be confusing to the buyer, who may expect that the item that is being recurred (such as a newspaper) is shipped, when in fact it is only the subscription being shipped, which is meaningless.

Submitting Recurrences for a Subscription

If you choose to handle recurring charges yourself, you are expected to submit recurrence requests at every recurrence period.

To charge a customer for a single recurrence period, send a <create-order-recurrence-request> that identifies the original order number for the subscription and the items for which the customer is being charged.

The <create-order-recurrence-request> should be posted to the order processing URLs:

Sandbox

https://sandbox.google.com/checkout/api/checkout/v2/request/Merchant/MERCHANT_ID

Production
https://checkout.google.com/api/checkout/v2/request/Merchant/MERCHANT_ID

The following XML example shows a sample <create-order-recurrence-request>:

<create-order-recurrence-request
  google-order-number="[SUBSCRIPTION_ORDER_NUMBER]"
  xmlns="http://checkout.google.com/schema/2">

  <shopping-cart>
    <items>
      <item>
        <item-name>Service for April 2008</item-name>
        <item-description>

          Monthly payment for site hosting from example.com
        </item-description>
        <quantity>1</quantity>
        <unit-price currency="USD">12.99</unit-price>
      </item>

    </items>
  </shopping-cart>
</create-order-recurrence-request>

The <create-order-recurrence-request> element contains a <shopping-cart> element, which, in turn, identifies the items for which the customer is paying.

If your original order specified a start-date for the subscription item, you can charge the customer any time after the subscription's start date. You will then be able to charge the customer once for each recurrence period that passes. For example, if a weekly subscription starts at 11:00 a.m. on May 21, 2008, then you will be able to charge the customer at that time and then again at 11:00 a.m. on May 28, 2008.

If your original order did not specify a start date for the subscription item, then you can charge the customer only after a complete recurrence period has passed since the time that the customer submitted the order. For example, if a customer submits an order for a weekly subscription at 11:00 a.m. on May 21, 2008, then Google will charge the customer the full content of the order as submitted, as usual. You will then be able to charge the customer at 11:00 a.m. on May 28, 2008, and any time after the start of each subsequent recurrence period.

Canceling A Subscription

Customer cancelled Subscription

A customer can cancel a subscription by viewing the receipt page for the initial subscription order, then clicking the Cancel Subscription link. If you're level 2 integrated, you will receive a cancelled-subscription-notification like the following :

<?xml version="1.0" encoding="UTF-8"?>
<cancelled-subscription-notification xmlns="http://checkout.google.com/schema/2" serial-number="968116944582449-00014-9">
  <item-ids />
  <google-order-number>968116944582449</google-order-number>
  <reason>Customer request to cancel</reason>
  <timestamp>2009-10-15T23:51:04.662Z</timestamp>
</cancelled-subscription-notification>

Merchant cancelled Subscription

To cancel a subscription as a merchant using our API to submit a <cancel-items> request for the specific subscription item in the cart. The documentation for this command can be found here.

XML Tag Definitions

Certain symbols may be displayed next to some subtags in the definitions below. These symbols, and their meanings, are:

? = optional subtag
* = zero or more instances of the subtag

Checkout API Request Tags

subscription
Definition

The <subscription> tag indicates that an item in an order is a subscription. If this tag is included, then the unit price for the item must be 0. (You will use the <subscription-payment> tag to identify the charges for the subscription.)

Attributes
NameFormatDescription
no-charge-after Date Optional. The no-charge-after attribute specifies the latest date and time that you can charge the customer for the subscription. This element can help you to ensure that you do not overcharge your customers.
period String Required. The period attribute specifies how frequently you will charge the customer for the subscription. Valid values for this attribute are DAILY, WEEKLY, SEMI_MONTHLY, MONTHLY, EVERY_TWO_MONTHS, QUARTERLY, and YEARLY.
start-date Date Optional. The start-date attribute specifies the date that the subscription's recurrence period will begin. Like all dates in Checkout, this is in ISO 8601 format. If you set the <unit-price> tag's value to a nonzero value, then the start-date for the subscription will automatically be set to the time that is exactly one recurrence period after the order is placed.
type String Required. The type attribute identifies the type of subscription that you are creating. The valid values for this attribute are merchant and google, and this specifies who handles the recurrences. The merchant value specifies Merchant-Handled recurrences, and the google value specifies Google-Handled recurrences.
Subtag of item
Subtags payments
Content Format Container
Example Monthly Merchant-Handled subscription, starting at July 1, 2009, 9:00 am PDT, and ensuring no charges take place after one year:
<subscription type="merchant" period="MONTHLY" start-date="2009-07-01T09:00:00-08:00" no-charge-after="2010-07-01T09:00:00-08:00">
...
</subscription>
Yearly Merchant-Handled subscription, able to start either when the user checks out or we first submit a recurrence charge. No limits on how long we can charge for:
<subscription type="merchant" period="YEARLY" type="merchant">
...
</subscription>

payments
Definition

The <payments> tag encapsulates information about the charges for a subscription, including the number of times each payment can be charged.

Subtag of subscription
Subtags subscription-payment*
Content Format Container

subscription-payment
Definition

The <subscription-payment> tag contains information about a charge associated with a subscription.

Attributes
NameFormatDescription
times Integer Optional. The times attribute indicates how many times you will charge the customer for a defined subscription payment. A subscription may have multiple payment schedules, and the times attribute lets you indicate how many times each charge will be assessed. For example, you might charge the customer a reduced rate for the first three months of a subscription and then charge the standard rate each month thereafter.
Subtag of payments
Subtags maximum-charge
Content Format Complex
Example Recur forever, or until the no-charge-after date (set on the subscription):
<subscription-payment>
...
</subscription-payment>
Recur 50 times, or until the no-charge-after date (set on the subscription):
<subscription-payment times=50>

...
</subscription-payment>

maximum-charge
Definition

The <maximum-charge> tag specifies the maximum amount that you will be allowed to charge the customer, including tax, for all recurrences.

Attributes
NameFormatDescription
currency String Required. The currency attribute identifies the unit of currency associated with the tag's value. The value of the currency attribute must be a three-letter ISO 4217 currency code.
Subtag of subscription-payment
Content Format Decimal
Example
<maximum-charge currency="USD">12.99</maximum-charge>

Order Processing API Request Tags

create-order-recurrence-request
Definition

The <create-order-recurrence-request> tag contains a request to charge a customer for one or more items in a subscription.

Attributes
NameFormatDescription
google-order-number String Required. The google-order-number attribute contains an ID that uniquely identifies an order.
Subtags shopping-cart
Content Format Complex
Example A recurrence for order 12345.
<create-order-recurrence-request google-order-number="12345"
...
</create-order-recurrence-request>
cancelled-subscription-notification
Definition

The <cancelled-subscription-notification> tag contains information about the cancellation of a subscription, including the item-ids, google order number, reason, and timestamp.

Attributes
Name Format Description
serial-number String The serial-number attribute contains an ID that uniquely identifies a Google Checkout notification.
Subtags item-ids , reason , timestamp
Content Format Container
Example
<?xml version="1.0" encoding="UTF-8"?>
<cancelled-subscription-notification xmlns="http://checkout.google.com/schema/2" serial-number="968116944582449-00014-9">
  <item-ids />
  <google-order-number>968116944582449</google-order-number>
  <reason>Customer request to cancel</reason>
  <timestamp>2009-10-15T23:51:04.662Z</timestamp>
</cancelled-subscription-notification>

XML Schema Changes

This section identifies the changes that will be made to the publicly available Google Checkout XML schema to enable support for subscriptions.

Updated Element Definitions

To enable support for subscriptions, the <item> tag has been updated. The <item> tag now has a new subtag, <subscription>, that contains information about the subscription, such as the start date of the subscription and the payment schedule.

<xs:complexType name="Item">
  <xs:all>
    <xs:element name="digital-content" type="tns:DigitalContent" minOccurs="0" />
    <xs:element name="item-description" type="xs:string" />
    <xs:element name="item-name" type="xs:string" />
    <xs:element name="item-weight" type="tns:ItemWeight" minOccurs="0" />

    <xs:element name="merchant-item-id" type="xs:string" minOccurs="0" />
    <xs:element name="merchant-private-item-data"
        type="tns:anyMultiple" minOccurs="0" />
    <xs:element name="quantity">
      <xs:simpleType>
        <xs:restriction base="xs:int">
          <xs:minInclusive value="1" />

        </xs:restriction>
      </xs:simpleType>
    </xs:element>
    <xs:element name="subscription" type="tns:Subscription" minOccurs="0" />
    <xs:element name="tax-table-selector" minOccurs="0">
      <xs:simpleType>

        <xs:restriction base="xs:string">
          <xs:minLength value="0" />
         <xs:maxLength value="255" />
        </xs:restriction>
      </xs:simpleType>
    </xs:element>

    <xs:element name="unit-price" type="tns:Money" />
  </xs:all>
</xs:complexType>

<xs:complexType name="NotificationDataResponse">
  <xs:all>
    <xs:element name="continue-token" type="xs:string" minOccurs="0" />
    <xs:element name="has-more-notifications" type="xs:boolean" minOccurs="0" />
    <xs:element name="notifications">
      <xs:complexType>
        <xs:sequence>
          <xs:choice minOccurs="0" maxOccurs="unbounded">
            <xs:element name="authorization-amount-notification" type="tns:AuthorizationAmountNotification" />
            <xs:element name="cancelled-subscription-notification" type="tns:CancelledSubscriptionNotification" />
            <xs:element name="charge-amount-notification" type="tns:ChargeAmountNotification" />
            <xs:element name="chargeback-amount-notification" type="tns:ChargebackAmountNotification" />
            <xs:element name="new-order-notification" type="tns:NewOrderNotification" />
            <xs:element name="order-state-change-notification" type="tns:OrderStateChangeNotification" />
            <xs:element name="refund-amount-notification" type="tns:RefundAmountNotification" />
            <xs:element name="risk-information-notification" type="tns:RiskInformationNotification" />
            <xs:element name="merchant-status-change-notification" type="tns:MerchantStatusChangeNotification" />
          </xs:choice>
        </xs:sequence>
      </xs:complexType>
    </xs:element>
  </xs:all>
  <xs:attribute name="serial-number" type="xs:string" use="required" />
</xs:complexType>
  

Newly Added Elements

The following elements have been added to the Checkout schema for the subscriptions feature.


<xs:complexType name="Subscription">
  <xs:all>
    <xs:element name="payments">
      <xs:complexType>
        <xs:sequence>
          <xs:element name="subscription-payment" type="tns:SubscriptionPayment"
              minOccurs="0" maxOccurs="unbounded" />

        </xs:sequence>
      </xs:complexType>
    </xs:element>
  </xs:all>
  <xs:attribute name="no-charge-after" type="xs:dateTime" use="optional" />
  <xs:attribute name="period" type="tns:DatePeriod" use="required" />

  <xs:attribute name="start-date" type="xs:dateTime" use="required" />
  <xs:attribute name="type" type="xs:string" use="required" />
</xs:complexType>

<xs:complexType name="SubscriptionPayment">
  <xs:all>
    <xs:element name="maximum-charge" type="tns:Money" />

  </xs:all>
  <xs:attribute name="times" type="xs:int" use="optional" />
</xs:complexType>

<xs:simpleType name="DatePeriod">
  <xs:restriction base="xs:token">
    <xs:enumeration value="DAILY" />

    <xs:enumeration value="WEEKLY" />
    <xs:enumeration value="SEMI_MONTHLY" />
    <xs:enumeration value="MONTHLY" />
    <xs:enumeration value="EVERY_TWO_MONTHS" />
    <xs:enumeration value="QUARTERLY" />
    <xs:enumeration value="YEARLY" />

  </xs:restriction>
</xs:simpleType>

<xs:element name="create-order-recurrence-request"
  type="tns:CreateOrderRecurrenceRequest"/>

<xs:complexType name="CreateOrderRecurrenceRequest">
  <xs:all>
    <xs:element name="shopping-cart" type="tns:ShoppingCart" />

  </xs:all>
  <xs:attribute name="google-order-number" type="xs:token" use="required" />
</xs:complexType>

<xs:complexType name="CancelledSubscriptionNotification">
  <xs:all>
    <xs:element name="google-order-number" type="xs:token" />
    <xs:element name="item-ids">
      <xs:complexType>
        <xs:sequence>
          <xs:element name="item-id" type="tns:ItemId" minOccurs="0" maxOccurs="unbounded" />
        </xs:sequence>
      </xs:complexType>
    </xs:element>
    <xs:element name="reason" type="xs:string" minOccurs="0" />
    <xs:element name="timestamp" type="xs:dateTime" />
  </xs:all>
  <xs:attribute name="serial-number" type="xs:string" use="required" />
</xs:complexType>

Known Issues

There are a few bugs remaining in this feature. They won't impact your ability to create or charge for subscriptions and their recurrences, but may make certain work-flows more difficult. We're working hard to get these fixed, but to keep you aware of difficulties you may experience while integrating, here's a short list of outstanding issues:

  • The only control you have over Google-Handled subscriptions is to cancel them, so they're best used in cases where you won't want to modify the content or timing of the recurrences at all.
  • Currently, you cannot cancel a subscription from the Merchant Center. As a workaround, you may:
    • Limit up-front the length of the subscription, if you know that it should last for a given period.
    • Use our API to cancel a subscription by canceling the item in the original cart which is the subscription item.
    • Refrain from charging (only if this subscription is Merchant-Handled).