stripe / stripe-java

Java library for the Stripe API.
https://stripe.com
MIT License
820 stars 360 forks source link

Feature Request: Preserve metadata key order in PaymentIntentCreateParams (and similar classes) #1178

Open Dretch opened 3 years ago

Dretch commented 3 years ago

I have recently changed some code so that it no longer uses PaymentIntent.html#create(Map) and instead uses PaymentIntent.html#create(PaymentIntentCreateParams).

This latter is a bit more type-safe, which is nice.

I have noticed however, that the order of the metadata keys is no longer being maintained. I am passing a LinkedHashMap to putAllMetadata but the Builder uses HashMap internally so the order is lost.

This means the keys show up in the Stripe dashboard in a semi-random order, which is not very pretty.

Using the first API, that takes a Map, then the metadata key order is indeed preserved, and the Stripe dashboard is easy to read.

My feature request is therefore: make the two APIs consistent and use a LinkedHashMap or similar so that it is possible to set the metadata key order regardless of API being used.

Thanks!

remi-stripe commented 3 years ago

@Dretch Thanks for reaching out! I can't promise we'll fix this as we conceptually never guarantee ordering of metadata in the API today but I agree that the fix should be straightforward enough that it is likely worth trying at least! We'll look into it!

michael-agilesrc commented 2 years ago

I wanted to follow up and see if there have been any updates in regards to this issue? I'm also using PaymentIntentCreateParams with putAllMetadata to add metadata to my payment intent, and I was hoping to have the ordering preserved on the stripe dashboard.

remi-stripe commented 2 years ago

@michael-agilesrc It's unlikely to be something we'll tackle in the near future at least as it's almost never asked and we have a really large list of improvements we want to get to.