def button_url(opts = {})
      opts = DefaultButtonOpts.merge opts
      opts[:buy_or_checkout] ||= @contents.size > 1 ? :checkout : :buy_now
      opts.merge! ButtonSizes[opts[:buy_or_checkout]][opts[:size]]
      bname = opts[:buy_or_checkout] == :buy_now ? 'buy.gif' : 'checkout.gif'
      opts.delete :size
      opts.delete :buy_or_checkout
      opts[:merchant_id] = @merchant_id

      path = opts.map { |k,v| "#{k}=#{v}" }.join('&')

      # HACK Sandbox graphics are in the checkout subdirectory
      subdir = ""
      if GoogleCheckout.sandbox? && bname == "checkout.gif"
        subdir = "checkout/"
      end

      # TODO Use /checkout/buttons/checkout.gif if in sandbox.
      "https://#{submit_domain}/#{ subdir }buttons/#{bname}?#{path}"
    end
def button_url(opts = {})
      opts = DefaultButtonOpts.merge opts
      opts[:buy_or_checkout] ||= @contents.size > 1 ? :checkout : :buy_now
      opts.merge! ButtonSizes[opts[:buy_or_checkout]][opts[:size]]
      bname = opts[:buy_or_checkout] == :buy_now ? 'buy.gif' : 'checkout.gif'
      opts.delete :size
      opts.delete :buy_or_checkout
      opts[:merchant_id] = @merchant_id

      path = opts.map { |k,v| "#{k}=#{v}" }.join('&')

      # HACK Sandbox graphics are in the checkout subdirectory
      subdir = ""
      if GoogleCheckout.sandbox? && bname == "checkout.gif"
        subdir = "checkout/"
      end

      # TODO Use /checkout/buttons/checkout.gif if in sandbox.
      "https://#{submit_domain}/#{ subdir }buttons/#{bname}?#{path}"
    end
Given a set of options for the button, button_url returns the URL
 for the button image.
 The options are the same as those specified on
 http://checkout.google.com/seller/checkout_buttons.html , with a
 couple of extra options for convenience.  Rather than specifying the
 width and height manually, you may specify :size to be one of :small,
 :medium, or :large, and that you may set :buy_or_checkout to :buy_now
 or :checkout to get a 'Buy Now' button versus a 'Checkout' button. If
 you don't specify :buy_or_checkout, the Cart will try to guess based
 on if the cart has more than one item in it.  Whatever you don't pass
 will be filled in with the defaults from DefaultButtonOpts.

   http://checkout.google.com/buttons/checkout.gif
   http://sandbox.google.com/checkout/buttons/checkout.gif