-
Notifications
You must be signed in to change notification settings - Fork 753
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
Stripe.Response<Stripe.Charge> does not contain header information #1204
Comments
One thing that is odd is that when the {
"type": "StripeInvalidRequestError",
"raw": {
"code": "token_in_use",
"doc_url": "https://stripe.com/docs/error-codes/token-in-use",
"message": "There is currently another in-progress request using this Stripe token (that probably means you clicked twice, and the other charge is still going through): ba_1JFKbuHaVrFFEQvKxUkfstDG. This token can not be used again if that charge is successful.'",
"type": "invalid_request_error",
"headers": {
"server": "nginx",
"date": "Wed, 28 Jul 2021 16:14:28 GMT",
"content-type": "application/json",
"content-length": "420",
"connection": "keep-alive",
"access-control-allow-credentials": "true",
"access-control-allow-methods": "GET, POST, HEAD, OPTIONS, DELETE",
"access-control-allow-origin": "*",
"access-control-expose-headers": "Request-Id, Stripe-Manage-Version, X-Stripe-External-Auth-Required, X-Stripe-Privileged-Session-Required",
"access-control-max-age": "300",
"cache-control": "no-cache, no-store",
"idempotency-key": "cc9be33b-5660-4ce1-88d6-6a57fe9bf26c-cc9be33b-5660-4ce1-88d6-6a57fe9bf26c-db3ba87b-81e4-4471-a1b4-19a2de81c5f7-2021-07-28",
"idempotent-replayed": "true",
"original-request": "req_pYbvZJ0OXzpfKn",
"request-id": "req_cyGe9oAOWKMUVa",
"stripe-should-retry": "false",
"stripe-version": "2020-08-27",
"x-stripe-c-cost": "0",
"strict-transport-security": "max-age=31556926; includeSubDomains; preload"
},
"statusCode": 400,
"requestId": "req_cyGe9oAOWKMUVa"
},
"rawType": "invalid_request_error",
"code": "token_in_use",
"doc_url": "https://stripe.com/docs/error-codes/token-in-use",
"headers": {
"server": "nginx",
"date": "Wed, 28 Jul 2021 16:14:28 GMT",
"content-type": "application/json",
"content-length": "420",
"connection": "keep-alive",
"access-control-allow-credentials": "true",
"access-control-allow-methods": "GET, POST, HEAD, OPTIONS, DELETE",
"access-control-allow-origin": "*",
"access-control-expose-headers": "Request-Id, Stripe-Manage-Version, X-Stripe-External-Auth-Required, X-Stripe-Privileged-Session-Required",
"access-control-max-age": "300",
"cache-control": "no-cache, no-store",
"idempotency-key": "cc9be33b-5660-4ce1-88d6-6a57fe9bf26c-cc9be33b-5660-4ce1-88d6-6a57fe9bf26c-db3ba87b-81e4-4471-a1b4-19a2de81c5f7-2021-07-28",
"idempotent-replayed": "true",
"original-request": "req_pYbvZJ0OXzpfKn",
"request-id": "req_cyGe9oAOWKMUVa",
"stripe-should-retry": "false",
"stripe-version": "2020-08-27",
"x-stripe-c-cost": "0",
"strict-transport-security": "max-age=31556926; includeSubDomains; preload"
},
"requestId": "req_cyGe9oAOWKMUVa",
"statusCode": 400
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The
charges.create
method returns aStripe.Response<Stripe.Charge>
object. TheStripe.Response
object is supposed to have aheaders
attribute like soIn reality, this attribute does not exist in the raw JSON.
In a conversation on the stripe discord server it appears the header information is actually stored on the
lastResponse
object. But again looking at theStripe.Response
definition, it is not present on that object.That leads us to having to rely on undocumented attributes and telling typescript to ignore them
The text was updated successfully, but these errors were encountered: