Stripe Connect:使用 Node.js 取消订阅
Stripe Connect: Cancel Subscription with Node.js
我正在 Stripe Connect 上构建一个平台,我完全不知道如何取消通过它创建的帐户。 Connect docs really only obliquely mention canceling subscriptions and I've followed the description in the core documentation 但是我收到 Customer X does not have a subscription with ID Y
错误,尽管我从仪表板复制了这两个值(显然,首先使用它们创建订阅。我看到了很多问题关于 RoR 方面,但我发现的所有修复似乎都是特定于此 API。我知道我可以删除客户,它最终会出现在同一个地方,但必须有一个更好的方法。
好的,很快。这只是我没有在文档中进行逻辑飞跃以及节点端的一些不完整信息:(
虽然您使用自己的 ID 创建订阅,但实际上是在用户注册计划时使用在回调 ([charge].subscriptions.data[0].id
) 中找到的订阅 ID 取消它们。存储后,您只需使用建议的通用代码即可,无需任何特定于 Connect 的更改
stripe.customers.cancelSubscription(
customer_id,
subscription_id,
function(err, confirmation) {
// asynchronously called
}
);
customer_id 看起来像这样 cus_xxxxxxxxxxxxxx
而 subscription_id 看起来像这样 sub_xxxxxxxxxxxxxx
将把它留在这里,因为我在上面找不到任何东西,希望它能帮助其他人。
我正在 Stripe Connect 上构建一个平台,我完全不知道如何取消通过它创建的帐户。 Connect docs really only obliquely mention canceling subscriptions and I've followed the description in the core documentation 但是我收到 Customer X does not have a subscription with ID Y
错误,尽管我从仪表板复制了这两个值(显然,首先使用它们创建订阅。我看到了很多问题关于 RoR 方面,但我发现的所有修复似乎都是特定于此 API。我知道我可以删除客户,它最终会出现在同一个地方,但必须有一个更好的方法。
好的,很快。这只是我没有在文档中进行逻辑飞跃以及节点端的一些不完整信息:(
虽然您使用自己的 ID 创建订阅,但实际上是在用户注册计划时使用在回调 ([charge].subscriptions.data[0].id
) 中找到的订阅 ID 取消它们。存储后,您只需使用建议的通用代码即可,无需任何特定于 Connect 的更改
stripe.customers.cancelSubscription(
customer_id,
subscription_id,
function(err, confirmation) {
// asynchronously called
}
);
customer_id 看起来像这样 cus_xxxxxxxxxxxxxx
而 subscription_id 看起来像这样 sub_xxxxxxxxxxxxxx
将把它留在这里,因为我在上面找不到任何东西,希望它能帮助其他人。