2010-10-10 47 views
0

我正在尝试将Google Checkout集成到我的网站中。我创建了下面的函数生成requred的HMAC-SHA-1签名:我根据这个代码断概述了http://code.google.com/apis/checkout/developer/Google_Checkout_XML_API.html#create_checkout_cartPython:Google Checkout签名功能

但是要求

def make_signature(cart_xml): 
    import hmac 
    import hashlib 
    import base64 

    # The number is a psuedo-merchantID, cart_xml contains a string with the 
    # shopping cart xml as outlined on google's documentation. 
    signature = hmac.new("711348421531236", cart_xml, hashlib.sha1) 
    signature = base64.b64encode(signature.digest()) 

    return signature 

,我不能让我的车验证签名。我不断收到以下错误:“购物车上的坏签名”

有谁知道如何解决此问题?

回答

0

想通了。我使用的是商户ID而不是商户密钥。