Reputation: 17584
I have a script that creates subscriptions for customers using the Node.js Stripe API.
After reading the documentation on how to create subscriptions I have arrived at the following code:
var stripe = require( "stripe" )( "my_TestKey" );
stripe.subscriptions.create({
"customer":"myCustomer",
"billing":"charge_automatically",
"trial_end":"1509186774",
"items": [ {"plan":"mySubscription"} ]
})
.then( console.log )
.catch( console.error );
However, this subscription fails with the following error:
"error":{"type":"StripeInvalidRequestError","stack":"Error: Invalid timestamp: must be an integer Unix timestamp in the future.\n at Constructor._Error ...
So, I assumed that my error was in the trial_end
field, and so I double checked the timestamp in the following websites:
Which both convert it successfully to a date. I also tried making the request with the date in milliseconds but then it obviously didn't work.
Upvotes: 0
Views: 4966
Reputation: 7218
The timestamp 1509186774
is for Saturday, 28 October 2017. The trial_end
parameter must for a date in the future — maybe you meant to use 28 October 2018, which is 1540722774
.
Upvotes: 1