Tipsi-stripe: Where do you guys save the stripe secret key?

Created on 5 Jun 2018  路  6Comments  路  Source: tipsi/tipsi-stripe

I saved the secret key just inside of the pay function. However, people keeping telling it my app could be cracked easily, then I will be in debt.

What does everyone else do?

Thank you!

screen shot 2018-06-05 at 12 40 15 pm

Most helpful comment

Your client app should never have the secret key and should not be able to get it.

All operations should be done on the backend side. Till you have no critical vulnerabilites that are allowing someone get inside your backend server - you save. Cannot comment about firebase as database for secure information, you should ensure that only your backend server can get this information.

All 6 comments

@brilliantjc basically, in the environment. For now, we are storing tokens on the backend

Do you need to encrypt it? in what way?

No, we don't encrypt secret keys on backend side. But there is no way to get this keys via API.

Because in China's most popular shopping website, people can easily purchase 2.1 billion app credit/coins by paying 5 RMB($0.8).

So, just wondering do we need to concern about that if someone hacks into our database? Mine is firebase.

screen shot 2018-06-05 at 2 40 11 pm

Your client app should never have the secret key and should not be able to get it.

All operations should be done on the backend side. Till you have no critical vulnerabilites that are allowing someone get inside your backend server - you save. Cannot comment about firebase as database for secure information, you should ensure that only your backend server can get this information.

If you're using Firebase, use Firebase cloud functions (on the backend) with your secret key to process charges. Create payment source tokens on the client-side (in your app) with your publishable key.

An example of cloud functions:
https://github.com/firebase/functions-samples/blob/master/stripe/functions/index.js

Was this page helpful?
0 / 5 - 0 ratings

Related issues

nenti picture nenti  路  5Comments

LcsLpr picture LcsLpr  路  4Comments

alexpchin picture alexpchin  路  4Comments

rheilgm picture rheilgm  路  6Comments

kingtross88 picture kingtross88  路  3Comments