stripe / stripe-cli

A command-line tool for Stripe
https://stripe.com/docs/stripe-cli
Apache License 2.0
1.57k stars 362 forks source link

`payment_method.detached` event trigger doesn't work #1209

Open vishal-sood opened 1 week ago

vishal-sood commented 1 week ago

The more information we have the easier it is for us to help. Feel free to remove any sections that might not apply

Issue

Describe what happened and what you were trying to do

Triggering the payment_method.detached event using the CLI (v1.20.0) doesn't work.

It fails with the following error:

Trigger failed: Request failed, status=404, body={
  "error": {
    "code": "resource_missing",
    "doc_url": " https://stripe.com/docs/error-codes/resource-misssing",
    "message" "No such PaymentMethod: '${payment_method_attach.id}'; It's possible this PaymentMethod exists on one of your connected accounts, in which case you should retry this request on that connected account. Learn more at https://stripe.com/docs/connect/authentication",
    "param": "payment_method",
    "request_log_url": <redacted>,
    "type": "invalid_request_error"
  }
}

Expected Behavior

Tell us what you expected to happen

The payment method detach API call to work which would eventually result in the payment_method.detached event being triggered

Steps to reproduce

What are the steps we can take to reproduce this and verify it's fixed?

Try running the following command Stripe CLI command:

stripe trigger payment_method.detached
vishal-sood commented 1 week ago

I've already created a PR which I believe would fix the issue: https://github.com/stripe/stripe-cli/pull/1207