Node.js 无法使用条带API创建带有时间戳的订阅 背景
我有一个脚本,可以使用Node.js Stripe API为客户创建订阅 代码 在阅读了有关的文档后,我得出了以下代码:Node.js 无法使用条带API创建带有时间戳的订阅 背景,node.js,stripe-payments,stripe.js,Node.js,Stripe Payments,Stripe.js,我有一个脚本,可以使用Node.js Stripe API为客户创建订阅 代码 在阅读了有关的文档后,我得出了以下代码: var stripe = require( "stripe" )( "my_TestKey" ); stripe.subscriptions.create({ "customer":"myCustomer", "billing":"charge_automatically", "trial_end":"1509186774", "items"
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 );
问题
但是,此订阅失败,并出现以下错误:
“错误”:{“类型”:“StripeInvalidRequestError”,“堆栈”:“错误:无效”
时间戳:将来必须是整数Unix时间戳。\n在
构造函数。\u错误
我试过的
因此,我假设我的错误出现在trial\u end
字段中,因此我在以下网站中仔细检查了时间戳:
- 我遗漏了什么?为什么stripe认为该字段无效
1509186774
用于2017年10月28日星期六的日期。trial\u end
参数必须用于将来的日期-可能您打算使用2018年10月28日,即1540722774