Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

$stripeApiKeyhas no type-hint #11

Open
nigelmann opened this issue Jul 9, 2018 · 2 comments
Open

$stripeApiKeyhas no type-hint #11

nigelmann opened this issue Jul 9, 2018 · 2 comments

Comments

@nigelmann
Copy link

Hey,

I working on a symfony 4 project and when i wanted to integrate the bundle. when i try to create a customer i have this

Uncaught PHP Exception Symfony\Component\DependencyInjection\Exception\RuntimeException: "Cannot resolve argument $stripeClient of "App\Controller\User\RegisterPaymentMethodController()": Cannot autowire service "Flosch\Bundle\StripeBundle\Stripe\StripeClient": argument "$stripeApiKey" of method "__construct()" has no type-hint, you should configure its value explicitly." at /Users/simonackermann/Sites/courses/symfony/champeryNb/var/cache/dev/ContainerOspQEUr/getStripeClientService.php line 9

I realy don't know what to do.
here is all my code;
https://github.com/simonackermann/private-rent/tree/feature/creditCardPayment

Thanks in advanc for the help

@flo-sch
Copy link
Owner

flo-sch commented Jul 9, 2018

Hello @simonackermann , it seems that you're version of Symfony cannot autowire scalar arguments: you should configure its value explicitly.

http://symfony.com/doc/master/service_container.html#manually-wiring-arguments

I have not used this bundle on a Symfony 4 project myself, so I cannot tell you why exactly the configuration inside your own flosch_stripe.yaml file does not work, but I guess this change should solve your problem:

# config/services.yaml
Flosch\Bundle\StripeBundle\Stripe\StripeClient:
    autowire: true
    autoconfigure: true
    lazy: true
    arguments:
        $stripeApiKey: '%your_stripe_api_key%' # maybe try '%flosch_stripe.stripe_api_key%'?

@nigelmann
Copy link
Author

@flo-sch thank you very much I don't have this error anymore.

However when i use the createCustomer method i get this error.

[critical] Uncaught PHP Exception Stripe\Error\ApiConnection: "Unexpected error communicating with Stripe.  If this problem persists, let us know at support@stripe.com.

(Network error [errno 35]: Server aborted the SSL handshake)" at /Users/simonackermann/Sites/courses/symfony/champeryNb/vendor/stripe/stripe-php/lib/HttpClient/CurlClient.php line 250

The Exception is in the stripe-php lib but maybe you have a clue on what the probleme is.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants