I am trying to get the level one integration of google wallet working as 
described in the manual.

Here is the view:

{{extend 'layout.html'}}
<h1>Checkout</h1>


{{from gluon.contrib.google_wallet import button}}
{{=button(merchant_id=my_merchantid,
    products=[dict(names="shoes",
                         quantity=1,
                         price=23.5,
                         currency='USD',
                         description="running shoes black")])}}


I note in the github that there was a change in March 2012 to this, but I 
did a diff on the file with what is in gluon/contrib and there were no 
differences.

The error I get on the integration console:
We were looking for the parameter buyButtonCart but we didn't find it in 
the cart post; check your form fields.

I've also tried to use the sandbox procedure by making a copy of 
gluon/contrib/google_wallet.py , copying this to google_sandbox_wallet.py

and modifying this,
from gluon import XML

def button(merchant_id="hereIenteredmysandboxmerchantid",
           products=[dict(name="shoes",
                          quantity=1,
                          price=23.5,
                          currency='USD',
                          description="running shoes black")]):
    t = '<input name="item_%(key)s_%(k)s" type="hidden" value="%(value)s"/>'
    list_products = ''
    for k,product in enumerate(products):
        for key,value in product.items():
            list_products += t % dict(k=k+1,key=key,value=value)
    button = '<form 
action="https://sandbox.google.com/checkout/api/checkoutForm/Merchant/%s"; 
id="BB_BuyButtonForm" method="post" name="BB_BuyButtonForm" 
target="_top">%s<input name="_charset_" type="hidden" value="utf-8"/><input 
alt="" 
src="http://sandbox.google.com/checkout/buttons/checkout.gif?merchant_id=mysandboxmerchid&w=180&amp;h=46&amp;style=white&amp;variant=text&amp;loc=en_US";
 
height="46" width="180"></form>' % (merchant_id, list_products, merchant_id)
    return XML(button)

and the view is the same as the one for the real checkout except I use the 
sandbox merchant id. and import the modified 
gluon/contrib/google_sandbox_wallet.py instead of google_wallet, using
{{from gluon.contrib.google_sandbox_wallet import button}}
 the rest is the same except using sandbox merchant id, and have taken care 
to use the correct paths to the
form and button for the sandbox.

with this sandbox combination I get the following error:

<type 'exceptions.TypeError'> not all arguments converted during string 
formatting


Traceback (most recent call last):
  File "/Applications/web2py/gluon/restricted.py", line 209, in restricted
    exec ccode in environment
  File "/Applications/web2py/applications/shop/views/default/buy.html", 
line 37, in <module>
  File "/Applications/web2py/gluon/contrib/google_sandbox_wallet.py", line 
14, in button
    button = '<form 
action="https://sandbox.google.com/checkout/api/checkoutForm/Merchant/%s"; 
id="BB_BuyButtonForm" method="post" name="BB_BuyButtonForm" 
target="_top">%s<input name="_charset_" type="hidden" value="utf-8"/><input 
alt="" 
src="http://sandbox.google.com/checkout/buttons/checkout.gif?merchant_id=xxxxxxx&w=180&amp;h=46&amp;style=white&amp;variant=text&amp;loc=en_US";
 
height="46" width="180"></form>' % (merchant_id, list_products, merchant_id)
TypeError: not all arguments converted during string formatting 

I've xxx out my sandbox merchant id

I would appreciate any help getting this fixed.

thanks,
Margaret

-- 



Reply via email to