Is the tos_acceptance.date parameter in Unix time? The documentation only says it should be a date.

From the looks of its value here (https://stripe.com/docs/api#account_object) and from the error message I receive when I try to make a call to Stripe assuming that the date is in Unix time, I get an error that says:

{
  "error": {
    "type": "invalid_request_error",
    "message": "ToS acceptance date is not valid. Dates are expected to be integers, measured in seconds, not in the future, and after 2009.",
    "param": "tos_acceptance[date]"
  }
}

But there is no documentation that tells us how this date value is supposed to be arrived at.

2

There are 2 best solutions below

0
On

Instead of using moment library, we can simply calculate unix timestamp as:

tos_acceptance.date = Math.floor(Date.now()/ 1000)
0
On

for anyone else that google this error

this is what i used

var moment = require('moment'); var time = moment.utc().valueOf(); tos_acceptance.date = Math.floor(time / 1000);

"integers, measured in seconds" SECONDS, not milliseconds. so not Date.now() which => the date in milliseconds