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

Using network retries causes client defined Idempotency Key to be over written #637

Closed
prettyboymp opened this issue Apr 19, 2019 · 2 comments · Fixed by #642
Closed

Using network retries causes client defined Idempotency Key to be over written #637

prettyboymp opened this issue Apr 19, 2019 · 2 comments · Fixed by #642

Comments

@prettyboymp
Copy link

When setting the idempotency_key option on a request, it gets overwritten if you are using network retries. The issue is being caused by a check for an existing Idempotency-Key in the headers array by key, however, the $headers array was already converted to a non-keyed array in ApiRequestor::_requestRaw().

Ref:

if (!isset($headers['Idempotency-Key'])) {

Example:

\Stripe\Stripe::setMaxNetworkRetries( 2 );
\Stripe\Charge::create( $charge_parameters, [
  'api_key' => 'abcdefg',
  'idempotency_key' => '1234-5678-abcd-efg',
]);

The request getting sent to the API are getting a newly generated idempotency_key instead of the one manually set.

@ob-stripe
Copy link
Contributor

Oops! Thanks for the report @prettyboymp, we'll work on a fix.

@ob-stripe
Copy link
Contributor

Fixed in 6.34.2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants