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

Bad invoice items URL #1158

Closed jcbages closed 2 months ago

jcbages commented 3 months ago

Issue

The URL for interacting with invoice items should be /invoiceitems but right now it's /invoice_items which makes stripe get ii_invoice_item_id calls fail

Expected Behavior

Calling stripe get with an invoice item ID should show the JSON object for the invoice item. Instead, it's showing an error that the URL is not valid as it's trying to fetch v1/invoice_items instead of v1/invoiceitems: https://docs.stripe.com/api/invoiceitems

Steps to reproduce

Run a command to get some invoice item with its ID:

stripe get ii_im_an_invoice_item_id

The current CLI returns the following error:

{
  "error": {
    "message": "Unrecognized request URL (GET: /v1/invoice_items/ii_im_an_invoice_item_id). Please see https://stripe.com/docs or we can help at https://support.stripe.com/.",
    "type": "invalid_request_error"
  }
}

However, getting the full path will correctly return the JSON object, which is the expected behavior from the first command:

stripe get v1/invoiceitems/ii_im_an_invoice_item_id

Traceback

{
  "error": {
    "message": "Unrecognized request URL (GET: /v1/invoice_items/ii_im_an_invoice_item_id). Please see https://stripe.com/docs or we can help at https://support.stripe.com/.",
    "type": "invalid_request_error"
  }
}

Environment

macOS

tomer-stripe commented 2 months ago

Hey @jcbages, what version of the CLI are you using? This looks like it's configured correctly (at least on the newest version): https://github.com/stripe/stripe-cli/blob/683f1bf5037ee294d33c77e3eabca0f2cee49ef6/pkg/requests/ids.go#L19

I tried it locally too and it seems to be working:

➜ stripe get ii_0P3JuV589O8KAxCGZ0onWjq7
{
  "id": "ii_0P3JuV589O8KAxCGZ0onWjq7",
  "object": "invoiceitem",
  "amount": 100,
  "currency": "usd",
...
jcbages commented 2 months ago

@tomer-stripe ya I opened this for the PR that fixed it https://github.com/stripe/stripe-cli/pull/1157 so I'll close now :)