My form is currently like this:
<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>
Using node.js, I create my signature like so (note that I do not use any order 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)
Now when I click submit, I get a callback at the following address: http://127.0.0.1:3000/credits?error=failure&error_description=Invalid+timestamp.
This means that at least my key/secret is valid and so is my signature, but my timestamp isn't.
What is wrong with my timestamp?
Javascript time is in milliseconds not seconds -_-