#unibit - Invalid API Key
1 messages · Page 1 of 1 (latest)
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
Can you share a request ID?
here is a sample for your reference
this code work fine in our previous version
we are using stripe.net
framewrok 4.6.1
Have you double checked that that is the correct key?
No one has rotated your keys?
no just double checked and even create a new private key but still the error remains
yes
in our last project we used 4.6 with no issues
do you think that is a framewrok issue ?
we are using stripe.net 39.84.0.0
your latest one is 39.89.0.0
When did it stop working? When you upgraded the stripe library version?
no we did not upgrade the stripe version just upgrade the visual studio from 2012 to 2022
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?
as you have seen in my screenshot the code breaks in that point i mention and does not go on
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.
Find help and support for Stripe. Our support center provides answers on all types of situations, including account information, charges and refunds, and subscriptions information. Get your questions answered and find international support for Stripe.
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
.
req_hUVNMUImnry8hM
That request has a 200 response
That means it used the proper api keys successfully
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
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?
for the moment yes, i havent check the connected account creator api
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.
what you mean?
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
i have to remind you that this code was working on our previous version
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
its very simple, its a payment from and a checkout server side form that process the form request
Right and it looks like the server side is having issues now. Unfortunately it is unclear what that might be without more info
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?
As in the form in your browser or some code on your server?
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
this code is working
Interesting. And just to make absolutely sure, can you replace that generic key with your actual secret?
with my key generate error invalid key
There we go. And this is your new key after you rolled it?
yes
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.
And you are using the string literal here, not importing it through a configuraiton?
no, just copy paste
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
check it youself
sk_test_51JJRtgNo5YGhFsCj5bw5fR5KJ7XUkgmb3BLHk8eDF3HosQOG5YNuIPuOSQ3rRyOnGLRupNZ041Y50NWEhN6wrUdH00VTYvRZZj
yes i click the copy button to be absolutely sure
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
You did this process in test mode, correct? https://stripe.com/docs/keys#rolling-keys
i did this process and created a new key but error remain
sk_test_51JJS5WZoBwomAWkcd2MhXDBrTeR1qPBWwgIM25g7Qidg3y5KID0VsMrrRe5lp2N3BuaiQWVs6S1gAnS2av4jfmHsQ00EyKZ7SmH
obviously something going wrong with key gen
I can roll my key and check
any luck?
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
can you pass me the keys that are working on you ?
sk_test_51KPWDHAvOAHkEXwQQjImhN8CEZmajIZQLhsja1dK4hDZpeeqXbEEmugQFKtLSlc1X9HkSb23KdxYExfVImMRyFgh00I4N9e4wp
this is working, so that means something is wrong with my account
what shall i do now ?
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
if your keys are working on me and my keys dont its 100% sure fault of keygen
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.
i did use your regex with same error😫
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?
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
I see it and grabbed the ticket. Will let you know what we can find as we dig deeper.
ok, thanks a lot for your help👍