#matt_error
1 messages ¡ Page 1 of 1 (latest)
đ Welcome to your new thread!
â˛ď¸ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.
âąď¸ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.
đ This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1357405135072137217
đ Have more to share? Add more details, code, screenshots, videos, etc. below.
Hi đ
can you explain the process where this error message is received?
Can you elaborate on the question
Can you share an API request ID for when you attempt to detach the payment method? It will start with req_
Here's how you can find a request ID: https://support.stripe.com/questions/finding-the-id-for-an-api-request
There is no API request ID because as I mentioned, these requests don't even show up in the console for some reason..
We get the error when running the following code with the PHP SDK:
$paymentMethod = PaymentMethod::retrieve($stripePaymentMethodId);
$paymentMethod->detach();
That response does not appear to be a Stripe error
All string errors are valid JSON and follow this structure: https://docs.stripe.com/api/errors
It's thrown right here in the Stripe SDK:
https://github.com/stripe/stripe-php/blob/master/lib/ApiRequestor.php#L176
PHP library for the Stripe API. . Contribute to stripe/stripe-php development by creating an account on GitHub.
Actually, the message there is slightly different
Can you share that message?
Invalid response object from API: {$rbody} " . "(HTTP response code was {$rcode})";
But you aren't seeing a HTTP response code when that is returned, are you? What you shared was actual HTML
We're seeing a 400 response code, but we do not see the request show up in the dashboard
I found the exact error in the version of the Stripe SDK that we're using:
https://github.com/stripe/stripe-php/blob/v12.0.0/lib/ApiRequestor.php#L549
PHP library for the Stripe API. . Contribute to stripe/stripe-php development by creating an account on GitHub.
So it looks like for whatever reason, when we hit the API, Stripe is returning an nginx error to us
Hi hi! Iâm going to be taking over for my colleague here. Can you share the Payment Method ID?
Sure, pm_1R7sWCIVLuRzysjdP0ijXtvj
Also here's the full error that we're receiving, since I noted that the original message cut it off:
{"code":400,"message":"Invalid response body from API:
<html>
\r\n
<head>
<title>
400 Bad Request
<\/title>
<\/head>
\r\n
<body>
\r\n
<center>
<h1>
400 Bad Request
<\/h1>
<\/center>
\r\n<hr>
<center>
nginx
<\/center>
\r\n
<\/body>
\r\n<\/html>\r\n (HTTP response code was 400, json_last_error() was 4)"}
Where are you receivng that error?
Here
At what time was the request attempted/did you get the error?
Latest request was at 10:53 PST. I can make a request again, but it seems like the requests aren't showing on our dashboard
That's great, thanks. Wait one.
Sure, thank you
Hey, just checking in to see if there are any updates on this
Still digging.
Alright, thank you
It looks like this response is happening because there is a null byte that is being sent along with your API key. Can you send me your code for how you are setting your API key in your stripe-php client?
Sure, one moment
Stripe::setApiKey($this->config['apiSecret']);
What I don't understand is, why is it being sent with only that one specific request when this is the way that we set our API key in every request and those seem to work
My mistake, it looks like the issue is in the URL that is getting sent to us. That is largely getting set by the PHP library, so I am guessing the null byte is somehow included in the payment method ID that you are providing us
How were you able to determine that the issue is to do with a null byte?
The type of internal error is coming from the HTTP request being malformed because of a null byte.
I see. Is it happening in the retrieve request or the detach request?
Looks to be the detach, though if there is an extra null character in the ID I would expect that to effect any call that you pass the ID to the same way