I don't know if you got this working. After much testing, it looks like the only problem in your code is the timestamp. Use date('YmdHisz')
Looks like $nonce can be any random string. Length does not appear to matter. I used a simple random alpha-numeric string generator with various random lengths. All worked.