stripe / stripe-java

Java library for the Stripe API.

Home Page:https://stripe.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

create EphemeralKey results in Received unknown parameter: stripe-version

carlwilk32 opened this issue · comments

Describe the bug

I started receiving a 'Received unknown parameter: stripe-version' error on EphemeralKey creation attempt (POST /v1/ephemeral_keys) after switching to latest 23.x.y and reworking previous codebase to it, i.e. using client methods instead of static resource methods.
My code before changes

            EphemeralKeyCreateParams ephemeralKeyParams = EphemeralKeyCreateParams.builder()
                    .setStripeVersion(apiVersion)
                    .setCustomer(customerId)
                    .build();
            return EphemeralKey.create(ephemeralKeyParams);

and after. basically, the same, but only changed the way ephemeral key is created

            EphemeralKeyCreateParams ephemeralKeyParams = EphemeralKeyCreateParams.builder()
                    .setStripeVersion(apiVersion)
                    .setCustomer(customerId)
                    .build();
            return client.ephemeralKeys().create(ephemeralKeyParams);

Checked the Stripe dashboard logs for POST /v1/ephemeral_keys and I clearly see that the client didn't send stripe-version before but sends it after changes were introduced to my code.
I then checked and saw that com.stripe.model.EphemeralKey#create(java.util.Map<java.lang.String,java.lang.Object>, com.stripe.net.RequestOptions) contains following string

    overriddenParams.remove("stripe-version");

To Reproduce

  1. Try to create EphemeralKey passing apiVersion as a param using new resource creation approach
            EphemeralKeyCreateParams ephemeralKeyParams = EphemeralKeyCreateParams.builder()
                    .setStripeVersion(apiVersion)
                    .setCustomer(customerId)
                    .build();
            EphemeralKey.create(ephemeralKeyParams);
            return client.ephemeralKeys().create(ephemeralKeyParams);

Expected behavior

Should return EphemeralKey instance for given customer, no errors should occur.

Code snippets

No response

OS

macOS

Java version

Java 17

stripe-java version

23.3.0

API version

2023-08-16

Additional context

No response

@carlwilk32 Thanks for the report and sorry about the trouble, this is definitely a bug in the new client implementation. We'll look into a fix and follow up with a release once ready!

The fix released in 23.4.0.