#unibit - Invalid API Key

1 messages · Page 1 of 1 (latest)

atomic elbow
#

Hey let's chat in here

wind temple
#

our project worked fine until we upgrade it to framework 4.6.1, although we are using the same valid keys we are getting same error message invalid API Key

atomic elbow
#

Can you share a request ID?

wind temple
#

here is a sample for your reference

#

this code work fine in our previous version

#

framewrok 4.6.1

atomic elbow
#

Have you double checked that that is the correct key?

#

No one has rotated your keys?

wind temple
#

no just double checked and even create a new private key but still the error remains

atomic elbow
#

You're using 4.6.1 of the dot net library?

#

That is a very old version

wind temple
#

yes

#

in our last project we used 4.6 with no issues

#

do you think that is a framewrok issue ?

atomic elbow
#

Oh the stripe version is what I was asking for ok

#

One second

wind temple
#

your latest one is 39.89.0.0

atomic elbow
#

When did it stop working? When you upgraded the stripe library version?

wind temple
#

no we did not upgrade the stripe version just upgrade the visual studio from 2012 to 2022

atomic elbow
#

Oh

#

So are you seeing this just as a warning in the IDE or actually when you run the code and try to make a request?

wind temple
#

as you have seen in my screenshot the code breaks in that point i mention and does not go on

atomic elbow
#

Can you share a request ID then? If the only thing that changed is Visual Studio version, then it's probably something to do with your environment. https://support.stripe.com/questions/finding-the-id-for-an-api-request#:~:text=Using the dashboard,the dashboard URL as well.

wind temple
#

Response body

{
"id": "tok_1KPUK6LoffM3pbuK99fGEbxl",
"object": "token",
"card": {
"id": "card_1KPUK5LoffM3pbuKKVaPgzhy",
"object": "card",
"address_city": null,
"address_country": null,
"address_line1": null,
"address_line1_check": null,
"address_line2": null,
"address_state": null,
"address_zip": null,
"address_zip_check": null,
"brand": "Visa",
"country": "US",
"cvc_check": "unchecked",
"dynamic_last4": null,
"exp_month": 12,
"exp_year": 2024,
"funding": "credit",
"last4": "4242",
"name": "buyer@gmail.com",
"tokenization_method": null
},
"client_ip": "62.74.27.110",
"created": 1643990866,
"email": "buyer@gmail.com",
"livemode": false,
"type": "card",
"used": false
}

Request POST body

{
"email": "buyer@gmail.com",
"validation_type": "card",
"payment_user_agent": "Stripe Checkout v3 (stripe.js/78ef418)",
"user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:96.0) Gecko/20100101 Firefox/96.0",
"device_id": "7fdd9dfc-245b-4f3c-91c2-cab5c86a98ef",
"referrer": "https://localhost:44316/payment_form.aspx?item_id=2043&item_fee=1342&email=buyer@gmail.com",
"time_checkout_opened": "1643990854",
"time_checkout_loaded": "1643990853",
"card": {
"number": "*********4242",
"cvc": "
",
"exp_month": "12",
"exp_year": "2024",
"name": "buyer@gmail.com"
},
"time_on_page": "13438",
"guid": "8b290cdc-85a5-4d2e-a98a-a3f0c8bc98cf1f8e0f",
"muid": "de853319-f76b-47cf-802b-5dc7edecff5917fb0a",
"sid": "e6597192-8972-4127-8843-e47faa024342eb020f",
"key": "pk_test_*********************************************************************************************VlWQqT"
}

Developers
Skip to content
Ayutogroup
Search…
Home
Payments
Balances
Customers
Products
Reports
Connect
Developers
Test mode
TEST DATA
We use cookies to improve your experience and for marketing. Learn more in our
cookie policy
.

atomic elbow
#

I need the request ID so I can look it up in our system

#

See above link

wind temple
#

req_hUVNMUImnry8hM

atomic elbow
#

That request has a 200 response

#

That means it used the proper api keys successfully

wind temple
#

yes i can see that from my log the prob is why is creating error on customercreateoptions ?

#

please check the screenshot i have send its self explanatory

atomic elbow
#

Yeah I saw. Let me check with some colleagues on this then. So with the same API key, that is the only API request that is causing an error?

#

Or are other requests also causing issues?

wind temple
#

for the moment yes, i havent check the connected account creator api

light token
#

Can you try other calls from your VS 2022 project directly? That token call was from a browser so the .NET version wouldn't affect it.

wind temple
#

what you mean?

light token
#

Can you make other calls from the C# API to see if they also get this error?

#

Also, to narrow down the issue, it might be helpful to make a new small project with just code to set up a Stripe client and make a customer create call. That could help us see if it is something else in the bigger project

wind temple
#

i have to remind you that this code was working on our previous version

light token
#

Understood. This can help us understand what is going wrong

#

4.6.1 is the minimum required version for working with our framework so unfortunately it is hard to say what might be the problem

wind temple
#

its very simple, its a payment from and a checkout server side form that process the form request

light token
#

Right and it looks like the server side is having issues now. Unfortunately it is unclear what that might be without more info

wind temple
#

about the framework, i did upgrade it to 4.7 but the issue is same

#

i can send you the client post form and the server code is that ok?

light token
#

As in the form in your browser or some code on your server?

wind temple
#

here is the client + server form

light token
#

Unfortunately not seeing anything that immediately jumps out at me there. Can you try running just this code in a new project and let me know if that works for you? ```using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Stripe;

namespace StripeApp
{
class Program
{
static void Main(string[] args)
{
StripeConfiguration.ApiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc";
var customer_service = new CustomerService();
var customer_options = new CustomerCreateOptions();
var customer = customer_service.Create(customer_options);
Console.WriteLine(customer);
Console.ReadLine();
}
}
}```

#

This can help us narrow down the issue

wind temple
#

this code is working

light token
#

Interesting. And just to make absolutely sure, can you replace that generic key with your actual secret?

wind temple
#

with my key generate error invalid key

light token
#

There we go. And this is your new key after you rolled it?

wind temple
#

yes

light token
#

Maybe try copying it again? Or rolling a completely new one and using that?

#

It sounds like we just need a proper test key. I get the error that you are seeing if I add or delete characters to one that works.

wind temple
#

let me create a new one

#

nothing, same error even with new key!

light token
#

And you are using the string literal here, not importing it through a configuraiton?

wind temple
#

no, just copy paste

light token
#

Otherwise, I have heard of invisible whitespace characters getting added to the mix. Can you try pasting in to notepad first to see if anything comes up?

#

I'm not sure how this might have happened if you just clicked the copy button but the key in your error looks like it has the normal form of a key

wind temple
#

check it youself

#

sk_test_51JJRtgNo5YGhFsCj5bw5fR5KJ7XUkgmb3BLHk8eDF3HosQOG5YNuIPuOSQ3rRyOnGLRupNZ041Y50NWEhN6wrUdH00VTYvRZZj

#

yes i click the copy button to be absolutely sure

light token
#

That is the key from the first error message you saw. If you rolled it, there should be a new key

#

I am also getting invalid key on that string

#

Probably because that old key was rolled

wind temple
#

i did this process and created a new key but error remain

#

sk_test_51JJS5WZoBwomAWkcd2MhXDBrTeR1qPBWwgIM25g7Qidg3y5KID0VsMrrRe5lp2N3BuaiQWVs6S1gAnS2av4jfmHsQ00EyKZ7SmH

#

obviously something going wrong with key gen

light token
#

I can roll my key and check

wind temple
#

any luck?

light token
#

Works on my account. I am what else I can see about your account and keys. I will reach out to my colleagues on this

wind temple
#

can you pass me the keys that are working on you ?

light token
#

sk_test_51KPWDHAvOAHkEXwQQjImhN8CEZmajIZQLhsja1dK4hDZpeeqXbEEmugQFKtLSlc1X9HkSb23KdxYExfVImMRyFgh00I4N9e4wp

wind temple
#

this is working, so that means something is wrong with my account

#

what shall i do now ?

light token
#

I don't think it necessarily means that. Can you try the most recent key that is currently in your dashboard again? It might help to run it through this Regex line which will replace any non-printable characters.
s = Regex.Replace(s, @"\p{C}+", string.Empty);

#

If it is that SmH key, that did not work for me but I am unsure which keys are expired. The view of your redacted keys that I have can take a bit to update properly

wind temple
#

if your keys are working on me and my keys dont its 100% sure fault of keygen

light token
#

We can look deeper in to that aspect of this. Can you try that Regex method really quick? It can be surprisingly easy to add extra characters.

#

After that I'd say write in to https://support.stripe.com/?contact=true and mention you were talking to Pompey. I can grab the ticket and make sure it goes to the right queue so we can look at this deeper.

wind temple
#

i did use your regex with same error😫

light token
#

I am sorry. This is tough. Also if you write in to support, can you let me know here so I can grab the ticket right away?

wind temple
#

just send an email

#

it cant be the regex cause the keys am generating are not working on both of us

#

on the other hand the keys you are generating working on both

light token
#

I see it and grabbed the ticket. Will let you know what we can find as we dig deeper.

wind temple
#

ok, thanks a lot for your help👍