views:

22

answers:

1

I am attempting to integrate Google Checkout into my website. I have created the following function for generating the hmac-sha-1 signature requred:

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

I based this code off of the requirements outlined on http://code.google.com/apis/checkout/developer/Google_Checkout_XML_API.html#create_checkout_cart

However, I cannot get my cart to validate the signature. I keep receiving the following error: "Bad Signature on Cart"

Does anyone know how to fix this?

A: 

Figured it out. I was using the Merchant ID instead of the Merchant Key.

Louis