Using the Stripe API with plain Javascript [closed] - javascript

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
I want to use the Stripe API for adding customer data using plain javascript.
Unfortunately there are no Javascript examples in the Stripe Docs... https://stripe.com/docs/api
I want to use Ajax POSTS
Now my questions are:
a) Where do I have to put my api key?
b) How do I send data and where exactly do I have to input it into the script?
c) What parameters do I have to use?

You can not do any of this in Javascript client-side for security reasons. Most API requests require your Secret API key. This key is really sensitive and something you should keep secure at all time.
If you use that key client-side then anyone can look at the source of your page and then use that key to create new charges, refund all your charges or delete all your customers.
Client-side, you would only collect card details securely with Elements or Checkout. This gives you a card token tok_XXXX and then you send that token to your server where you will create a Charge or a Customer.
That last part can be done in Javascript using Stripe's Node.js library but the code has to run server-side.

Related

end to end encryption with javascript and php [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I'm looking to implement end-to-end encryption for messages sent between users in my Laravel app. I want to encrypt these messages in a way that they are only viewable by the sender and receiver (just like in secure messaging apps like WhatsApp). No one else can read them, including admins or dbas.
How would I go about doing this?
I should also mention that the messages will be sent through the browser to the server by a JavaScript AJAX request and pushed to the other user by Node.js / socket.io setup.
Would be helpful if you have posted some examples that you have tried. Here are the steps that you can follow to achieve it.
Step 1. You will have to establish a private chat between Client and server. An example can be seen here: Creating a private chat between a key using a node.js and socket.io
Step 2. Add encryption/decryption logic for the messages at Client side. Here is a logic for the same: https://github.com/sytelus/CryptoJS

How to connect html page to Marklogic Database using javascript? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I am newbie to web designing. Here I am trying to develop a web page where it prompts for username and password and when I click on button, this html has to make connection with these username and password values entered by user to Marklogic database . Could anyone please help how to do this? Is it through Javascript or PHP? If so please advise where can I find step by step explanation of this process ? Also it is okay if I get procedure for any NOSQL database.
OK. Your statement is a bit big and broad.. I decided to extract the most relevant concepts:
Sample Application including authentication
MarkLogic
Javascript or PHP
Therefore, I suggest looking at a reference framework using all javascript:
http://www.marklogic.com/what-is-marklogic/whats-new/samplestack/
This can have a node.js middle tier in node.js and does not require java.
It is a big step forward and (sort of) complex, but it is a complete example.
If it is too much for what you are looking for, then I suggest you research more specifically what you need in these two specific items in MarkLogic documents:
HTTP Server (where you can run your HTML/CSS/Javascript from)
REST API (for which you can use against your js code)
This is a 2-tier approach where your application(HTTP) server is serving both your HTTP site as well s the default REST enpoints.

How java script login page works? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
How JavaScript take user ID and password? And where do it stores that data? And how it check the authentication when next time user wants to login in?
It doesn't. JavaScript running in the browser cannot perform meaningful authentication. You'd need a server-side application that performs the authentication. At most, JavaScript could perform an AJAX request, sending the user ID and password to the server — but how exactly you'd do that would depend entirely on the application. You'd need to read the documentation for your system to find out how authentication is performed.
(It is conceivable that we're talking about a server-side application written in JavaScript à la node.js, but since the question is not tagged as such I'm assuming not.)

Get Tweets from Angularjs [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I'am trying to get tweets from a twitter acount but only using angularjs, whitout php or another language.
I have tried but I couldn't. and also I have to use the 1.1 twitter api
1.We don't support or recommend performing OAuth directly through
Javascript -- it's insecure and puts your application at risk. The
only acceptable way to perform it is if you kept all keys and secrets
server-side, computed the OAuth signatures and parameters server side,
then issued the request client-side from the server-generated OAuth
values.
2.The OAuth access token will need to be part of the call and
the oauth_token_secret will need to be used to compute the signature
3.No
from Twitter Dev site

Writing to a database using javascript bad idea? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I made a database that holds information about clinical trials and so far I have been accessing and writing to it using php. I was wondering if there was a way to read/write to a SQL Server database using javascript or jquery? The UI I am developing will be for adding clinical trial data to the database. Only the DB admins will have access to this UI so security should not be a "huge" problem.
You need a middle tier like php, rails, java... to do the database write. You can't do this from the browser with javascript. But there is Node.js, which allows you do write javascript on the server.
In short, no. Even if there was, you should never leave data validation to the client. Just because your DB Admins are trustworthy, doesn't mean those who break into your network will be. DROP TABLE ClinicalTrialData; would be a bad thing. Use PHP/backend of choice to do the donkeywork and use AJA[X|J] if you want a slick UI experience.
Only server side Javascript methods such as using NodeJS as your server. Never put your database credentials on the front end unless you want people to directly access your database.

Categories

Resources