Closed talon55 closed 8 years ago
I did a little bit more digging, and it turns out that the issue depends on the order of the keys in the nested subarrays. From the above example, this causes the bug:
'address' =>array (...),
'dob' => array (...),
'first_name' => 'xgvukvfrde',
'last_name' => 'rtcyvubhy',
but this works as intended:
'first_name' => 'xgvukvfrde',
'last_name' => 'rtcyvubhy',
'address' =>array (...),
'dob' => array (...),
Thanks for the detailed report @saber3005! Looking at the log line you sent over, it looks like this was received properly in your request, and the correct response was sent back. I suspect the issue was with the update post-creation (since we take the response we get back from the server and update the Account object with its data). I'm digging deeper now.
(Nevermind, I've reproduced exactly as you described this)
@bkrausz Thanks for the fix!
Released as part of 3.9.1.
I've been trying to create a system for generating managed accounts for users in Europe, where money laundering laws demand a fairly complex list of information. In particular, a complete verification requires a list of additional owners, each with almost the complete set of data that the primary user provides. Unfortunately, submitting this information using this SDK causes some weird behavior, which I'll demonstrate using the following code and its output:
And the output:
The problem here is that each subarray within the
additional_owners
field (ie.'address'
and'dob'
) is getting shifted up in the response. This is easiest to see fordob
because it's all numeric:In the request:
And the response:
I've done some testing, and I've traced the issue to how the SDK and API handle indexed arrays. Specifically, lines 210-214 in
Stripe\HttpClient\CurlClient::encode()
differentiate between indexed and associative arrays:If I modify it to look like this:
Then the API receives the data correctly (albeit with the
additional_owners
array represented as an object with numeric indices) and provides the proper response. I'm not sure if you can view data from my Stripe account, but the response logs for this test are at https://dashboard.stripe.com/test/logs/req_7vsH7fDUhIkpR3.Please let me know if I can provide any more information to help you resolve this bug.