flo-sch / stripe-bundle

A symfony >= 3 integration for the Stripe PHP SDK
MIT License
28 stars 10 forks source link

fix for stripe_api_key for symfony 3.2 #2

Closed larkarvin closed 1 day ago

flo-sch commented 7 years ago

Hey @larkarvin, thanks for the PR!

Did you have any problem using Symfony 3.2 ? I am not sure I had any trouble with it actually, could you explain the problem in a few words?

soufyaneM commented 7 years ago

Hey after installation i have this error :

The service "flosch.stripe.client" has a dependency on a non-existent parameter "stripe_api_key". Did you mean this: "flosch_stripe.stripe_api_key"?

flo-sch commented 7 years ago

Hey @soufyaneM, IMHO I think it relate to a customized parameter (from app/config/parameters.yml which I called stripe_api_key in the example, containing the actual api key of your Stripe platform account (either test or live secret key, depending of your environment)

Are you using such a parameter in your parameters.yml file?

soufyaneM commented 7 years ago

No i start with your bundle and i have this error ! You think i need to add this parameter ?

flo-sch commented 7 years ago

In the example (README.md), I just added a shortcut yo use Symfony parameters.

If, in your /app/config/config.yml file, you include such lines :

# app/config/config.yml
flosch.stripe:
    stripe_api_key: "%stripe_api_key%"

Then you need to add the stripe_api_key parameter in your /app/config/parameters.yml file, such as (here, in test mode) :

# app/config/parameters.yml
parameters:
    # // ...
    stripe_api_key: "sk_test_XXXYYYZZZ"

NB : it is of course possible to include it directly in the config.yml file, if you want to share the key between different environments, even though I do not think this is what anybody wishes :

# app/config/config.yml
flosch.stripe:
    stripe_api_key: "sk_test_XXXYYYZZZ"
soufyaneM commented 7 years ago

It's ok thks you :+1: