Javascript 条带API测试密钥是否仅限于某些功能?
我第一次使用Stripe构建了一个电子商务应用程序。我正在向端点Javascript 条带API测试密钥是否仅限于某些功能?,javascript,node.js,stripe-payments,api-key,Javascript,Node.js,Stripe Payments,Api Key,我第一次使用Stripe构建了一个电子商务应用程序。我正在向端点/v1/products发出GET请求,使用Dominister或Stripe npm包获取我的完整产品数据,然后这些数据将填充目录页面 我的问题是,测试密钥条带提供的功能是否有限?当我使用它时,返回的数据是一个空数组,而liveapi键返回的是填充了产品的数组 这: 返回以下内容: { "object": "list", "data": [], "has_more": false, "url": "/v1/products" }
/v1/products
发出GET请求,使用Dominister或Stripe npm包获取我的完整产品数据,然后这些数据将填充目录页面
我的问题是,测试密钥条带提供的功能是否有限?当我使用它时,返回的数据是一个空数组,而liveapi键返回的是填充了产品的数组
这:
返回以下内容:
{
"object": "list",
"data": [],
"has_more": false,
"url": "/v1/products"
}
{
"object": "list",
"data": [
{
"id": "tower",
"object": "product",
"active": true,
"attributes": [
"height",
"colour",
"waterproof"
],
"caption": "Tower",
"created": 1520612842,
"deactivate_on": [],
"description": null,
"images": [],
"livemode": true,
"metadata": {},
"name": "Tower",
"package_dimensions": {
"height": 20.0,
"length": 20.0,
"weight": 700.0,
"width": 80.0
},
"shippable": true,
"skus": {
"object": "list",
"data": [
{
"id": "t001",
"object": "sku",
"active": true,
"attributes": {
"height": "1600",
"colour": "White",
"waterproof": "False"
},
"created": 1520612987,
"currency": "gbp",
"inventory": {
"quantity": 10,
"type": "finite",
"value": null
},
"livemode": true,
"metadata": {},
"package_dimensions": {
"height": 20.0,
"length": 20.0,
"weight": 700.0,
"width": 80.0
},
"price": 90000,
"product": "tower",
"updated": 1520674446
},
{
"id": "t002",
"object": "sku",
"active": true,
"attributes": {
"height": "1600",
"colour": "White",
"waterproof": "True"
},
"created": 1520613174,
"currency": "gbp",
"image": null,
"inventory": {
"quantity": 10,
"type": "finite",
"value": null
},
"livemode": true,
"metadata": {},
"package_dimensions": {
"height": 20.0,
"length": 20.0,
"weight": 700.0,
"width": 80.0
},
"price": 110000,
"product": "tower",
"updated": 1520613174
}
],
"has_more": false,
"total_count": 8,
"url": "/v1/skus?product=tower&active=true"
},
"type": "good",
"updated": 1520674071,
"url": null
}
],
"has_more": false,
"url": "/v1/products"
}
而将条带化测试密钥
交换为条带化活动密钥
会返回以下结果:
{
"object": "list",
"data": [],
"has_more": false,
"url": "/v1/products"
}
{
"object": "list",
"data": [
{
"id": "tower",
"object": "product",
"active": true,
"attributes": [
"height",
"colour",
"waterproof"
],
"caption": "Tower",
"created": 1520612842,
"deactivate_on": [],
"description": null,
"images": [],
"livemode": true,
"metadata": {},
"name": "Tower",
"package_dimensions": {
"height": 20.0,
"length": 20.0,
"weight": 700.0,
"width": 80.0
},
"shippable": true,
"skus": {
"object": "list",
"data": [
{
"id": "t001",
"object": "sku",
"active": true,
"attributes": {
"height": "1600",
"colour": "White",
"waterproof": "False"
},
"created": 1520612987,
"currency": "gbp",
"inventory": {
"quantity": 10,
"type": "finite",
"value": null
},
"livemode": true,
"metadata": {},
"package_dimensions": {
"height": 20.0,
"length": 20.0,
"weight": 700.0,
"width": 80.0
},
"price": 90000,
"product": "tower",
"updated": 1520674446
},
{
"id": "t002",
"object": "sku",
"active": true,
"attributes": {
"height": "1600",
"colour": "White",
"waterproof": "True"
},
"created": 1520613174,
"currency": "gbp",
"image": null,
"inventory": {
"quantity": 10,
"type": "finite",
"value": null
},
"livemode": true,
"metadata": {},
"package_dimensions": {
"height": 20.0,
"length": 20.0,
"weight": 700.0,
"width": 80.0
},
"price": 110000,
"product": "tower",
"updated": 1520613174
}
],
"has_more": false,
"total_count": 8,
"url": "/v1/skus?product=tower&active=true"
},
"type": "good",
"updated": 1520674071,
"url": null
}
],
"has_more": false,
"url": "/v1/products"
}
我已经解决了这个问题。我没有意识到实时数据和测试数据是完全分区的,为了让测试api密钥工作,有必要在测试门户中分别创建产品
万一其他人遇到此问题,请在Stripe仪表板上单击“查看测试数据”开关,然后按照流程再次创建产品。虽然没有解决OP的具体问题,但我也有同样的症状,并注意到解决方案,希望它能帮助其他人
在开发人员仪表板中,当我们从一个系统迁移到一个新系统时,我将使用一个旧的API版本。我需要更新以使用最新的API版本来解决这个问题,并获得一个完全填充的/v1/products调用。我投票结束这个问题,因为这个问题是离题的。嗨,Jörg,你在客户支持问题上链接的帖子说,询问使用公司的API是可以接受的。无论如何,我现在已经发现了我的错误并解决了这个问题。我不能接受我自己的答案,否则我会把这个问题解决。