StripeAuthenticationError error on stripeAPI.paymentMethods.list
See original GitHub issueHi there,
when I try to list specific customer as stated here:
stripe.paymentMethods.list({customer: 'customerid', type: 'card'});
I got 400 with following result
type: 'StripeInvalidRequestError',
raw: {
message: 'Invalid string: {:customer=>"cus_HngFprv2g3XFJQ"}',
param: 'customer',
type: 'invalid_request_error',
headers: {
server: 'nginx',
date: 'Sun, 09 Aug 2020 03:17:53 GMT',
'content-type': 'application/json',
'content-length': '157',
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',
'request-id': 'req_SzhsHOVznnqQRd',
'stripe-version': '2020-03-02',
'strict-transport-security': 'max-age=31556926; includeSubDomains; preload'
},
but why?
And I fixed this issue but using
stripe.paymentMethods.list(customer, 'card'});
and result became
type: 'StripeAuthenticationError',
raw: {
message: 'Invalid API Key provided: card',
type: 'invalid_request_error',
headers: {
server: 'nginx',
date: 'Sun, 09 Aug 2020 03:14:35 GMT',
'content-type': 'application/json',
'content-length': '106',
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',
'www-authenticate': 'Bearer realm="Stripe"',
'strict-transport-security': 'max-age=31556926; includeSubDomains; preload'
},
statusCode: 401,
requestId: undefined
},
rawType: 'invalid_request_error',
code: undefined,
doc_url: undefined,
param: undefined,
detail: undefined,
headers: {
server: 'nginx',
date: 'Sun, 09 Aug 2020 03:14:35 GMT',
'content-type': 'application/json',
'content-length': '106',
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',
'www-authenticate': 'Bearer realm="Stripe"',
'strict-transport-security': 'max-age=31556926; includeSubDomains; preload'
},
requestId: undefined,
statusCode: 401,
charge: undefined,
decline_code: undefined,
payment_intent: undefined,
payment_method: undefined,
setup_intent: undefined,
source: undefined
}
Weird thing is, it works with curl
https://api.stripe.com/v1/payment_methods?customer=cus_id&type=card
My Stripe SDK Version: stripe": "^8.84.0 but I also tried with “stripe”: “^8.79.0”, before update
My node version is => v12.18.2
OS Windows 10
Thanks
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Error codes | Stripe Documentation
See the documentation on payment errors for an example. Below is a list of possible error codes, along with additional information about how...
Read more >node.js - Stripe Api is having issue while creating a payment
when i try to execute this my data is successfully be stored in database but unfortunately when it comes with stripe api it...
Read more >stripe | Yarn - Package Manager
The Stripe Node library provides convenient access to the Stripe API from applications written in server-side JavaScript.
Read more >Error payment_methods · Issue #636 · stripe/stripe-node
I am using Stripe API 6.36.0 and node 8.4 Initial request from the Stripe ... As if I need to create the paymentMethod...
Read more >Stripe.PaymentMethod — stripity_stripe v2.17.2 - HexDocs
Stripe API reference: https://stripe.com/docs/api/payment_methods ... List all payment methods. retrieve(id, opts \\ []). Retrieve a payment method.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
It uses
'card'
as your API key, which is invalid, so that’s why you get a 401.I know what it means. Can you please check this?
IMO, 400 makes sense here