Cant retrieve Stripe checkout sessions (retrieve function not defined) - javascript

I'm trying to integrate the new Stripe checkout sessions into my website. On the NodeJS backend, I am trying to get the price from the created session, so I would try to use the checkout.sessions.retrieve function. When I invoke it like this:
session = await stripe.checkout.sessions.retrieve(cs_test_ABC*etc);
I get the following error:
TypeError: stripe.checkout.sessions.retrieve is not a function.
Can't really see where this error is coming from, as I am defining a stripe const at the beginning of my NodeJS file:
const stripe = require('stripe')('sk_test_AAAetc');
Has anyone encountered this before or knows possible steps to resolve this? Thank you so much!

That's the correct syntax to retrieve the session. I suspect that your version of stripe-node is not up to date. You need to be on at least version 6.28.0 to retrieve Checkout sessions.

Related

How to send Hcaptcha token with Python?

I need to automatically register accounts in one service and there I need to solve a captcha. I use this code to send captcha token:
send_token = driver.find_element(By.NAME, "h-captcha-response")
send_token.send_keys(form_token)
This code only works on simple demo sites. This method does not work in my service, here is the website:
https://auth.alchemy.com/signup?redirectUrl=https%3A%2F%2Fdashboard.alchemy.com%2Fsignup%3Fa%3Dgoerli_faucet%26redirectUrl%3Dhttps%253A%252F%252Fgoerlifaucet.com%252F%253FauthRefresh%253DTrue
I'm just starting to learn Python and JS I don't know at all.
I would like to know the principle of searching for this "place", where to send the token and how to do it, thanks in advance)
I have examples of sending a token using JS in other services. Maybe this will help somehow)
1:
driver.execute_script("verifyCallback(arguments[0])", (form_token))
2:
driver.execute_script("form_token = arguments[0]", (form_token))
driver.execute_script('hcaptcha.getResponse = function() {return form_token}')
It seems to me that I found the "place" where the token appears after solving the captcha manually, but unfortunately I don't know what to do with it)

What is the VS2022 eqivalent to "Azure Identity Plugin for Visual Studio Code Authentication"?

im trying to authenticate towards Azure using my local user in VisualStudio2022 in my local development environment using the following:
const { DefaultAzureCredential } = require("#azure/identity");
const credential = new DefaultAzureCredential();
but nothing is found, and I'm signed in in VS2022.
Should credentials be found automatically, or do i need to spesify that it is the VS2022 credentials i want to use?
Does https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity-vscode/README.md work only for VS-Code, and not vs2022?
Edit 1: Elaboration: As i understand it, "credentials" can be from "EnvironmentCredentials", "DefaultManagedIdentityCredentials", "AzureCLI" or "AzurePowerSHell".
Beeing logged into azure with corret subscription in VS2022, i expected my credentials to be in one of these to contain my credentials.
Btw: i get a "DefaultAzureCredential => failed to retrieve a token from the included credentials. To troubleshoot, visit"
What is the "included credentials" ?
Edit 2: I can get a token using Azure CLI as descibed here: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity/TROUBLESHOOTING.md#verify-the-azure-cli-can-obtain-tokens
This was solved using the azure sdk require("#azure/identity");
And i guess its fetching credentials though AzureCLI , event though its not visible when instantiating the credentials, which i was expecting. But its all undefined as can be seen in picture below.
Then, just trying to get the secret from keyVault it worked, although i'm not 100% sure how its working.
const client = new SecretClient(url, credential);
await client.getSecret(secretName);

How to get oauth access token using puppeteer?

I need to first fetch the oauth access token and then pass it as a parameter to my post request,
please let me know how this can be achieved using puppeteer.
I am new to puppeteer and I am stuck kindly assist.
Was unable to find an appropirate way to resolve the issue with puppeteer, I resolved it using Axios

Im getting this error: firebase.INTERNAL.registerAppHook is not a function, why?

I am trying to setup firebase web client messaging.
I couldn't find this error mentioned anywhere
I have my firebase account and basic firebase code in my app.
Authentication seems to be working, I had some errors about that and fixed them.
Now I'm trying to retrieve some info from the DB but I'm getting this error.
Yes, the DB has info in it.
Here is my code ( without the auth data, yes I have that info from my account and yes I have the container with that id setup as well )
This is js inside some PHP, seems to be loading correctly with no errors
// Initialize Firebase
firebase.initializeApp(firebaseConfig);
const preObject = document.getElementById("object");
const dbRefObject = firebase.database().ref().child("object");
dbRefObject.on("value", snap => console.log(snap.val()));
I am getting this error and I couldn't find info about it anywhere:
TypeError: firebase.INTERNAL.registerAppHook is not a function
I was expecting info to be retrieved and shown on site
The error is arising from the line:
<script defer src="https://www.gstatic.com/firebasejs/3.1.0/firebase-auth.js"></script>
Remove it and try again!

Notification count in Angular by the help of node js

i am new in programming. I have a conceptual question.
I have a API /getNotificationCount/{userId} to get count of any type of notification for every user. {userId} is int value. (Backend API buit in Symfony2)
In front end i am using angular, right now i am calling /getNotificationCount/{userId} API every time(by the help of timeout function) in angular controller(ajax call) to get count.
Is there is any way to do when server hits changes(increase or decrease count) then i will get api request to get count. I searched many thing i found by the help of node js i can do this but i am unable to understand how can i start ? Can anyone please give me suggestion on this ?
Sounds like you need WebSockets, have a look here to get started
try to use firebase to send notification.
for server side you should use firebase admin and messaging function .
i use it in my react native front and nodeJs back project

Categories

Resources