我的表单当前是这样的:
<form action="https://www.dwolla.com/payment/pay" method="POST" class="form-horizontal">
<input type="hidden" name="_csrf" value="[redacted]">
<input type="hidden" name="key" value="[redacted]">
<input type="hidden" name="signature" value="[redacted]">
<input type="hidden" name="timestamp" value="1347696587496">
<input type="hidden" name="callback" value="http://127.0.0.1:3000/donate/dwolla">
<input type="hidden" name="redirect" value="http://127.0.0.1:3000/credits">
<input type="hidden" name="test" value="1">
<input type="hidden" name="destinationId" value="812-726-7978">
<input type="hidden" name="shipping" value="0.25">
<input type="hidden" name="tax" value="0">
<input type="hidden" name="name" value="donation credit">
<input type="hidden" name="description" value="donation credit">
<!-- amount input and submit button -->
</form>使用node.js,我像这样创建我的签名(请注意,我没有使用任何订单ids):
dwolla.signature.create = function(timestamp) {
return crypto
.createHmac('sha1', dwolla.secret)
.update(dwolla.key)
.update('&')
.update(timestamp.getTime().toString())
.update('&')
.digest('hex')
}
var timestamp = new Date()
var signature = dwolla.signature.create(timestamp)现在,当我单击submit时,我在以下地址得到一个回调:http://127.0.0.1:3000/credits?error=failure&error_description=Invalid+timestamp.这意味着至少我的密钥/秘密是有效的,我的签名也是有效的,但我的时间戳不是。
我的时间戳有什么问题?
发布于 2012-09-16 09:05:47
Javascript时间以毫秒为单位,而不是秒--
https://stackoverflow.com/questions/12435748
复制相似问题