#wannalearn - importing stripe
1 messages · Page 1 of 1 (latest)
Hello! Just starting a thread for you -- I'll review and respond as soon as I can 🙂
What are you trying to do exactly? That package is for server side requests in node. Are you trying to load Stripe.js?
example node-server-side:
import Stripe from "stripe";
import { configs } from "../Functions";
// Set your secret key. Remember to switch to your live secret key in production.
// See your keys here: https://dashboard.stripe.com/apikeys
const secret_key = configs?.stripe?.stripe_test_key;
export const stripe = new Stripe(secret_key);
//IMPORTANT NOTE: THIS DOES NOT APPLY TO 429's!!!
stripe.setMaxNetworkRetries(2);
example react-client-side:
import { loadStripe } from "@stripe/stripe-js";
export let stripe = null;
export let stripe_started = false;
export let stripe_running = false;
(async () => {
try {
stripe = await loadStripe("pk_test_xxxx");
stripe_running = true;
} catch (err) {
stripe_running = false;
} finally {
stripe_started = true;
}
})();
OK, but that looks different that what you shared
so what are you trying to do that leads to the snippet you initially shared?
(Sorry @jolly raptor , that's me offering suggestions to @cursive belfry )
Oh, thanks - i hadn't noticed that