Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stripe CLI sends metadata fields that contain a dot as arrays #1064

Open
jtorreguitarcompass opened this issue Apr 28, 2023 · 0 comments
Open
Labels
bug Something isn't working

Comments

@jtorreguitarcompass
Copy link

Issue

I was trying to trigger an event through the CLI using the following command:

stripe trigger payment_intent.payment_failed --add payment_intent:metadata."Order No."="37018189"

Which returned the following response:

Trigger failed: Request failed, status=400, body={
  "error": {
    "message": "Invalid value type: [\"37018189\"] must be a string",
    "param": "metadata",
    "request_log_url": "https://dashboard.stripe.com/test/logs/req_QcLulON5e8gLUe?t=1682686037",
    "type": "invalid_request_error"
  }
}

When visiting the URL provided the request shows the value for that metadata field was sent as an array:

{
  "description": "(created by Stripe CLI)",
  "metadata": {
    "Order No": [
      "37018189"
    ]
  },
  "currency": "usd",
  "payment_method": "pm_card_chargeDeclined",
  "confirm": "true",
  "amount": "2000",
  "payment_method_types": [
    "card"
  ]
}

When I remove the dot at the end of the "Order No." metadata field the request is sent as desired (with the value as a string instead of an array). The successful command would be:

stripe trigger payment_intent.payment_failed --add payment_intent:metadata."Order No"="37018189"

Expected Behavior

I expected the "Order No." value to be sent as a string. Something like so:

{
  "description": "(created by Stripe CLI)",
  "metadata": {
    "Order No.": "37018189"
  },
  "currency": "usd",
  "payment_method": "pm_card_chargeDeclined",
  "confirm": "true",
  "amount": "2000",
  "payment_method_types": [
    "card"
  ]
}

Steps to reproduce

Trigger a stripe event with the param containing a dot like in the first command shown:

stripe trigger payment_intent.payment_failed --add payment_intent:metadata."Order No."="37018189"

Traceback

https://dashboard.stripe.com/test/logs/req_QcLulON5e8gLUe?t=1682686037

Environment

macOS

@jtorreguitarcompass jtorreguitarcompass added the bug Something isn't working label Apr 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant