Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/oop/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python:Google签出签名函数_Python_Payment Gateway_Google Checkout - Fatal编程技术网

Python:Google签出签名函数

Python:Google签出签名函数,python,payment-gateway,google-checkout,Python,Payment Gateway,Google Checkout,我正在尝试将Google Checkout集成到我的网站中。我创建了以下函数,用于生成所需的hmac-sha-1签名: 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 ou

我正在尝试将Google Checkout集成到我的网站中。我创建了以下函数,用于生成所需的hmac-sha-1签名:

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
我基于上概述的要求编写此代码

但是,我无法让我的购物车验证签名。我一直收到以下错误:“购物车上的签名错误”


有人知道如何解决这个问题吗?

解决了。我使用的是商户ID而不是商户密钥