You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何在Stripe仪表盘授予rak_plan_read权限解决接口报错问题

Stripe创建Checkout订阅会话报rak_plan_read权限缺失的解决方案

问题场景

开发订阅支付功能时,通过如下代码创建Stripe Checkout订阅结账会话:

const prices = await stripe.prices.list({
    lookup_keys: [body.lookupKey],
    expand: ['data.product'],
});
const session = await stripe.checkout.sessions.create({
    billing_address_collection: 'auto',
    customer: body.customerId,
    line_items: [
        {
            price: prices.data[0].id,
            quantity: 1,
        },
    ],
    mode: 'subscription',
    success_url: body.successUrl,
    cancel_url: body.cancelUrl,
});

代码运行抛出权限错误:

Error: The provided key 'rk_test_***' does not have the required permissions for this endpoint on account 'acct_xxxxxxx'. Having the 'rak_plan_read' permission would allow this request to continue.

当前该受限密钥已配置的权限如下:

Customers - Write
PaymentIntents - Write
Products - Read
Checkout Sessions - Write

在Stripe仪表盘查找plan_read对应配置入口失败,已知官方已将Plans对象替换为Prices对象,无法定位对应的权限配置项。

问题原因

Stripe做API版本迭代时,前端权限配置面板已经将旧版Plans资源的权限合并到Prices资源分类下,但后端权限校验逻辑未完全同步,仍保留旧版rak_plan_read的校验标识。这个标识实际对应的就是Prices资源的读权限,不存在单独的Plans权限配置入口,报错本质是当前密钥缺少Prices资源的读权限。

操作步骤

  • 进入Stripe仪表盘的受限密钥管理页,找到当前调用接口使用的密钥进入编辑态
  • 在权限列表中找到Prices资源项,为其授予*Read(读)*权限,仅做价格查询场景不需要开启写权限
  • 保存权限配置后等待1~2分钟,待权限缓存生效后重新发起请求即可正常执行

提示:Products读权限和Prices读权限是两个独立的权限配置项,不要混淆,开启Prices读权限即可通过rak_plan_read规则校验,无需寻找已下线的Plans权限配置。

内容的提问来源于stack exchange,提问作者Mike Hogan

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.28 19:27:23