You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Sep 24, 2020. It is now read-only.
Hi sorry, I'm very New to this How do I create/ add a charges on the form?
Stripe shows a way how to do it, but i don't.
// Set your secret key: remember to change this to your live secret key in production
// See your keys here: https://dashboard.stripe.com/account/apikeys
var stripe = require("stripe")("sk_test_A8rby2nqvlUtn6Ze1EEKeTLR");
// Get the credit card details submitted by the form
var token = request.body.stripeToken; // Using Express
// Create a charge: this will charge the user's card
var charge = stripe.charges.create({
amount: 1000, // Amount in cents
currency: "eur",
source: token,
description: "Example charge"
}, function(err, charge) {
if (err && err.type === 'StripeCardError') {
// The card has been declined
}
});
The text was updated successfully, but these errors were encountered:
One thing is for sure, you should not do this "on the form" (client side), only on your back-end. Stripe auto-generates snippets for you in common programming languages in their docs section. I would go with that.
Any snippet using the secret key (sk_) is only for back-end use. That's why you also have a publishable (public) key (pk_) that only serves in getting a token for a card. So it cannot compromise your account in any way.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Hi sorry, I'm very New to this How do I create/ add a charges on the form?
Stripe shows a way how to do it, but i don't.
The text was updated successfully, but these errors were encountered: