// Methods
        public static void InitialCharge()
        {
            //http://code.google.com/apis/checkout/developer/Google_Checkout_Beta_Subscriptions.html
              //using an initial charge with a recurring charge using a different item.

              CheckoutShoppingCartRequest cartRequest
            = new CheckoutShoppingCartRequest("123456", "merchantkey", EnvironmentType.Sandbox, "USD", 120);

              //if you are using a web page and it has the Google Checkout button, you would use this syntax.
              //= GCheckoutButton1.CreateRequest()

              ShoppingCartItem initialItem = new ShoppingCartItem();
              ShoppingCartItem recurrentItem = new ShoppingCartItem();

              initialItem.Price = decimal.Zero;
              initialItem.Quantity = 1;
              initialItem.Name = "Item that shows in cart";
              initialItem.Description = "This is the item that shows in the cart";

              recurrentItem.Price = 2M;
              recurrentItem.Quantity = 1;
              recurrentItem.Name = "Item that is charged every month";
              recurrentItem.Description = "Description for item that is charged every month";

              Subscription subscription = new Subscription();
              subscription.Period = GCheckout.AutoGen.DatePeriod.MONTHLY;
              subscription.Type = SubscriptionType.merchant;

              SubscriptionPayment payment = new SubscriptionPayment();
              payment.MaximumCharge = 120M;
              payment.Times = 12;

              subscription.AddSubscriptionPayment(payment);

              //You must set the item that will be charged for every month.
              subscription.RecurrentItem = recurrentItem;

              //you must set the subscription for the item
              initialItem.Subscription = subscription;

              cartRequest.AddItem(initialItem);

              Debug.WriteLine(EncodeHelper.Utf8BytesToString(cartRequest.GetXml()));

              //Send the request to Google
              //GCheckout.Util.GCheckoutResponse resp = cartRequest.Send();

              //Uncommment this line or perform additional actions
              //if (resp.IsGood) {
              //Response.Redirect(resp.RedirectUrl, True)
              //}
              //else{
              //Response.Write("Resp.ResponseXml = " & Resp.ResponseXml & "<br>");
              //Response.Write("Resp.RedirectUrl = " & Resp.RedirectUrl & "<br>");
              //Response.Write("Resp.IsGood = " & Resp.IsGood & "<br>");
              //Response.Write("Resp.ErrorMessage = " & Resp.ErrorMessage & "<br>");
              //}
        }
 /// <summary>
 /// This method adds an item to an order. This method handles items that 
 /// do not have &lt;merchant-private-item-data&gt; XML blocks associated 
 /// with them.
 /// </summary>
 /// <param name="Name">The name of the item. This value corresponds to the 
 /// value of the &lt;item-name&gt; tag in the Checkout API request.</param>
 /// <param name="Description">The description of the item. This value 
 /// corresponds to the value of the &lt;item-description&gt; tag in the 
 /// Checkout API request.</param>
 /// <param name="MerchantItemID">The Merchant Item Id that uniquely
 /// identifies the product in your system.</param>
 /// <param name="Quantity">The number of this item that is included in the 
 /// order. This value corresponds to the value of the &lt;quantity&gt; tag 
 /// in the Checkout API request.</param>
 /// <param name="taxTable">The <see cref="AlternateTaxTable"/> 
 /// To assign to the item </param>
 /// <param name="subscription">The subscription item</param>
 public ShoppingCartItem AddItem(string Name, string Description,
     string MerchantItemID, int Quantity, AlternateTaxTable taxTable,
     Subscription subscription)
 {
     _alternateTaxTables.VerifyTaxRule(taxTable);
       ShoppingCartItem retVal
     = new ShoppingCartItem(Name, Description, MerchantItemID, 0,
     Quantity, taxTable);
       retVal.Subscription = subscription;
       _items.Add(retVal);
       return retVal;
 }
        public static void RecurringChargeRightAway()
        {
            CheckoutShoppingCartRequest cartRequest
            = new CheckoutShoppingCartRequest("123456", "merchantkey", EnvironmentType.Sandbox, "USD", 120);
              //if you are using a web page and it has the Google Checkout button, you would use this syntax.
              //= GCheckoutButton1.CreateRequest()

              Subscription gSubscription = new Subscription();
              SubscriptionPayment maxCharge = new SubscriptionPayment();

              DigitalItem urlDigitalItem = new DigitalItem(new Uri("http://www.url.com/login.aspx"),
            "Congratulations, your account has been created!");

              DigitalItem urlDigitalItemSubscription = new DigitalItem(new Uri("http://www.url.com/login.aspx"),
            "You may now continue to login to your account.");

              ShoppingCartItem gRecurrentItem = new ShoppingCartItem();
              maxCharge.MaximumCharge = 29.99M;

              gRecurrentItem.Name = "Entry Level Plan";
              gRecurrentItem.Description = "Allows for basic stuff. Monthly Subscription:";
              gRecurrentItem.Quantity = 1;
              gRecurrentItem.Price = 29.99M;
              gRecurrentItem.DigitalContent = urlDigitalItemSubscription;
              gRecurrentItem.DigitalContent.Disposition = DisplayDisposition.Pessimistic;

              urlDigitalItem.Disposition = DisplayDisposition.Pessimistic;

              gSubscription.Type = SubscriptionType.google;
              gSubscription.Period = GCheckout.AutoGen.DatePeriod.MONTHLY;
              gSubscription.AddSubscriptionPayment(maxCharge);
              gSubscription.RecurrentItem = gRecurrentItem;

              cartRequest.AddItem("Entry Level Plan", "Allows for basic stuff.", 1, gSubscription);
              cartRequest.AddItem("Entry Level Plan", "First Month:", 29.99M, 1, urlDigitalItem);

              cartRequest.MerchantPrivateData = "UserName:Joe87";

              Debug.WriteLine(EncodeHelper.Utf8BytesToString(cartRequest.GetXml()));

              //Send the request to Google
              //GCheckout.Util.GCheckoutResponse resp = cartRequest.Send();

              //Uncommment this line or perform additional actions
              //if (resp.IsGood) {
              //Response.Redirect(resp.RedirectUrl, True)
              //}
              //else{
              //Response.Write("Resp.ResponseXml = " & Resp.ResponseXml & "<br>");
              //Response.Write("Resp.RedirectUrl = " & Resp.RedirectUrl & "<br>");
              //Response.Write("Resp.IsGood = " & Resp.IsGood & "<br>");
              //Response.Write("Resp.ErrorMessage = " & Resp.ErrorMessage & "<br>");
              //}
        }
 /// <summary>
 /// This method adds an item to an order. This method handles items that 
 /// do not have &lt;merchant-private-item-data&gt; XML blocks associated 
 /// with them.
 /// </summary>
 /// <param name="Name">The name of the item. This value corresponds to the 
 /// value of the &lt;item-name&gt; tag in the Checkout API request.</param>
 /// <param name="Description">The description of the item. This value 
 /// corresponds to the value of the &lt;item-description&gt; tag in the 
 /// Checkout API request.</param>
 /// <param name="MerchantItemID">The Merchant Item Id that uniquely
 /// identifies the product in your system.</param>
 /// <param name="Quantity">The number of this item that is included in the 
 /// order. This value corresponds to the value of the &lt;quantity&gt; tag 
 /// in the Checkout API request.</param>
 /// <param name="digitalItem">
 /// The &lt;digital-content&gt; tag contains information relating to
 /// digital delivery of an item.
 /// </param>
 /// <param name="subscription">The subscription item</param>
 public ShoppingCartItem AddItem(string Name, string Description,
     string MerchantItemID, int Quantity, DigitalItem digitalItem,
     Subscription subscription)
 {
     ShoppingCartItem retVal = new ShoppingCartItem(Name, Description,
     MerchantItemID, 0, Quantity);
       retVal.DigitalContent = digitalItem;
       retVal.Subscription = subscription;
       _items.Add(retVal);
       return retVal;
 }
 /// <summary>
 /// This method adds an item to an order. This method handles items that 
 /// do not have &lt;merchant-private-item-data&gt; XML blocks associated 
 /// with them.
 /// </summary>
 /// <param name="Name">The name of the item. This value corresponds to the 
 /// value of the &lt;item-name&gt; tag in the Checkout API request.</param>
 /// <param name="Description">The description of the item. This value 
 /// corresponds to the value of the &lt;item-description&gt; tag in the 
 /// Checkout API request.</param>
 /// <param name="Quantity">The number of this item that is included in the 
 /// order. This value corresponds to the value of the &lt;quantity&gt; tag 
 /// in the Checkout API request.</param>
 /// <param name="subscription">The subscription item</param>
 public ShoppingCartItem AddItem(string Name, string Description,
     int Quantity, Subscription subscription)
 {
     ShoppingCartItem retVal = new ShoppingCartItem(Name, Description,
     string.Empty, 0, Quantity);
       retVal.Subscription = subscription;
       _items.Add(retVal);
       return retVal;
 }
 /// <summary>
 /// This method adds an item to an order. This method handles items that 
 /// have &lt;merchant-private-item-data&gt; XML blocks associated with them.
 /// </summary>
 /// <param name="Name">The name of the item. This value corresponds to the 
 /// value of the &lt;item-name&gt; tag in the Checkout API request.</param>
 /// <param name="Description">The description of the item. This value 
 /// corresponds to the value of the &lt;item-description&gt; tag in the 
 /// Checkout API request.</param>
 /// <param name="MerchantItemID">The Merchant Item Id that uniquely
 /// identifies the product in your system.</param>
 /// <param name="Quantity">The number of this item that is included in the 
 /// order. This value corresponds to the value of the &lt;quantity&gt; tag 
 /// in the Checkout API request.</param>
 /// <param name="MerchantPrivateItemDataNodes">An XML node that should be 
 /// associated with the item in the Checkout API request. This value 
 /// corresponds to the value of the value of the 
 /// &lt;merchant-private-item-data&gt; tag in the Checkout API 
 /// request.</param>
 /// <param name="subscription">The subscription item.</param>
 public ShoppingCartItem AddItem(string Name, string Description,
     string MerchantItemID, int Quantity, XmlNode MerchantPrivateItemDataNodes,
     Subscription subscription)
 {
     ShoppingCartItem retVal
     = new ShoppingCartItem(Name, Description, MerchantItemID, 0,
     Quantity, AlternateTaxTable.Empty, MerchantPrivateItemDataNodes);
       retVal.Subscription = subscription;
       _items.Add(retVal);
       return retVal;
 }
 /// <summary>
 /// This method adds an item to an order. This method handles items that 
 /// have &lt;merchant-private-item-data&gt; XML blocks associated with them.
 /// </summary>
 /// <param name="Name">The name of the item. This value corresponds to the 
 /// value of the &lt;item-name&gt; tag in the Checkout API request.</param>
 /// <param name="Description">The description of the item. This value 
 /// corresponds to the value of the &lt;item-description&gt; tag in the 
 /// Checkout API request.</param>
 /// <param name="Quantity">The number of this item that is included in the 
 /// order. This value corresponds to the value of the &lt;quantity&gt; tag 
 /// in the Checkout API request.</param>
 /// <param name="MerchantPrivateItemData">An XML block that should be 
 /// associated with the item in the Checkout API request. This value 
 /// corresponds to the value of the value of the 
 /// &lt;merchant-private-item-data&gt; tag in the Checkout API 
 /// request.</param>
 /// <param name="subscription">The subscription information.</param>
 public ShoppingCartItem AddItem(string Name, string Description,
     int Quantity, string MerchantPrivateItemData, Subscription subscription)
 {
     ShoppingCartItem retVal
     = new ShoppingCartItem(Name, Description, string.Empty, 0,
     Quantity, AlternateTaxTable.Empty, MakeXmlElement(MerchantPrivateItemData));
       retVal.Subscription = subscription;
       _items.Add(retVal);
       return retVal;
 }
        /// <summary>
        /// Clone the object.
        /// </summary>
        /// <returns></returns>
        public object Clone()
        {
            Subscription retVal = new Subscription();
              retVal.NoChargeAfter = this.NoChargeAfter;
              foreach (SubscriptionPayment payment in this.Payments) {
            retVal.Payments.Add(payment.Clone() as SubscriptionPayment);
              }
              retVal.Period = this.Period;
              ICloneable clone = this.RecurrentItem as ICloneable;
              if (clone != null)
            retVal.RecurrentItem = clone.Clone() as IShoppingCartItem;
              retVal.StartDate = this.StartDate;
              retVal.Type = this.Type;

              return retVal;
        }