#agent-subs-apikey
1 messages · Page 1 of 1 (latest)
two things here
maybe i need to be using live keys on live products?
1/ yes, live objects can only be used with live mode API keys
2/
invalid API Key provided: "pk_test*****"
you're passing a publishable key, you need to use your secret key server-side to call the Subscription API
Ah i'm sorry
1/ I'm trying to use the test object, but the documentation mentioned to move the object to live before building the integration, i'll find the link in a moment
2/ I apologize, i was trying the secret and figured "well maybe i totally misunderstand something" so tried the public, then when writing this by hand wrote it out as "private key", i've tried both my test keys and receive the same error
1/ I'm trying to use the test object, but the documentation mentioned to move the object to live before building the integration, i'll find the link in a moment
if you're in test mode, yuou do not need to clone into live mode objects, you can stay using test mode objects with test mode keys
2/ I apologize, i was trying the secret and figured "well maybe i totally misunderstand something" so tried the public, then when writing this by hand wrote it out as "private key", i've tried both my test keys and receive the same error
what error? please always share the error msg so I can look
overall I think there's some confusion so can unravel based on what you're trying to do
sure one moment
stripe.subscriptions.create({
customer: customer.id,
items: [{
price: process.env.HUB_SUB_PRICE
}],
payment_behavior: 'default_incomplete',
expand: ['latest_invoice.payment_intent'],
});
StripeAuthenticationError: Invalid API Key provided: "sk_test**************************************************************************************************Si",
at res.toJSON.then.StripeAPIError.message (F:\WORK\subscription_test\node_modules\stripe\lib\StripeResource.js:214:23)
at processTicksAndRejections (node:internal/process/task_queues:96:5) {
type: 'StripeAuthenticationError',
raw: {
message: 'Invalid API Key provided: "sk_test**************************************************************************************************Si",',
type: 'invalid_request_error',
headers: {
server: 'nginx',
date: 'Thu, 28 Oct 2021 15:43:46 GMT',
'content-type': 'application/json',
'content-length': '214',
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: {
< truncated so my message fits in discord >
},
requestId: undefined,
statusCode: 401,
< truncated so my message fits in discord >
}
there's some mistake or typo in your API key? I can't / won't ask you for it (please don't share it) but please go to your Dashboard -> Developers -> API keys and confirm you have the correct/full secret key