使用 Lambda 函数订阅费用失败时条纹 webhooks

Stripe webhooks when subscription charge fails with Lambda function

如果使用 webhook 对 Stripe 订阅收费失败(除非有更好的方法),我很想知道取消订阅的想法。

这是我的想法。

  1. Stripe 订阅无法向客户收费
  2. Stripe webhook 使用 invoice.payment_failed
  3. 向 API 发出请求
  4. API 触发 Lambda 函数
  5. Lambda 函数删除 Cognito custom:stripesubid 属性和用户组

有用吗?如果有的话,我很乐意看到一些示例代码。

谢谢。

你应该使用webhooks from Stripe. Here is a good tutorial of how to do exactly what you are needing: https://www.truespotmedia.com/testing-webhooks-in-stripe-with-php/