This course is archived!
This tutorial uses an older version of Symfony of the stripe-php SDK. The majority of the concepts are still valid, though there *are* differences. We've done our best to add notes & comments that describe these changes.
04.
7 Comments
Hello, what is the right file in Symfony4 for fit with the parameters.yml in video (1:08) ?
Thank you !
I was thinking the same thing, its pretty simple.
In the
.env.local, I just add two environment variables:<br />STRIPE_SECRET_KEY=YourCrazyArsedTokenFromStriped_shhhSecret<br />STRIPE_PUBLIC_KEY=YourCrazyArsedTokenFromStriped_pffttelleveryone<br />Then in the
framework.ymlfile you just pull them out. :)`
stripe_public_key: '%env(STRIPE_PUBLIC_KEY)%'
stripe_private_key: '%env(STRIPE_SECRET_KEY)%'
`
Now you can just grab them like any other variable from the config files.
Hey Peter
Thanks for good example, just instead of
framework.ymlit's better to useconfig/services.yamlCheers!
hey ojtouch
It depends on what you need to store. For sensitive data(secret keys etc.) you should use
.env.localor other env-related files like.env.*.localfor other dataconfig/services.yamlor.env,.env.*Cheers!
Hello,
I have a problem with my constructer (in StripeClient.php class)
`public function __construct(EntityManagerInterface $em)
$secretKey return null
I store it here services.yaml
`parameters:
and in my .env.local
###STRIPE KEYS###<br />STRIPE_PUBLIC_KEY=pk_test_EaLhidden<br />STRIPE_SECRET_KEY=sk_test_AghiddenCan you help me please ?
Thanks
Hey ojtouch
I'm not sure, because I don't know how your
getParameter()works, But in your case, I prefer to use service definition for passing this parameter. For examplein
config/services.yamlunderservices:section defineand change your
StripeClientconstructor toHope this will help
Cheers!!
Thank you sadikoff ! It Works !!
"Houston: no signs of life"
Start the conversation!