【问题标题】:Python: Google Checkout Signature FunctionPython:Google Checkout 签名函数
【发布时间】:2010-10-10 23:36:22
【问题描述】:

我正在尝试将 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

我将此代码基于http://code.google.com/apis/checkout/developer/Google_Checkout_XML_API.html#create_checkout_cart 中概述的要求

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

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

【问题讨论】:

    标签: python payment-gateway google-checkout


    【解决方案1】:

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2017-11-06
      • 2021-05-02
      • 2018-07-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多