user4869699
user4869699

Reputation:

integrate Stripe in symfony

I am devolping a website in symfony framework.In the website i want to

integrate stripe payment gateway.While I integrate Stripe I got Error

There is no token with ID tok_6OvjZrmqRYk0Wu.

Here is My Function:


    public function indexAction()
    {
        $request = $this->container->get('request');
        $message = '';
        if($request->get('test'))
        {
            Stripe::setApiKey('sk_test_4zvcPWcVyDPt4wZcVwqe95Xc');

            $token = $request->get('stripeToken');

            $customer = \Stripe_Customer::create(array(
                  'email' => '[email protected]',
                  'card'  => $token
            ));

            $charge = Stripe_Charge::create(array(
                  'customer' => $customer->id,
                  'amount'   => 5000,
                  'currency' => 'usd'
            ));

            $message = '<h1>Successfully charged $50.00!</h1>';
        }


}

Here is Script which I have used in html file

  <script src="https://checkout.stripe.com/v2/checkout.js" class="stripe-button"
          data-key="pk_test_ur0ebwOGBrsNzQrpdCNENIu4"
          data-data-amount="1900" 
          data-data-description="One year's subscription"
          data-address='true'
          data-name='Test'
          data-description='Test Transaction'
          data-panel-label='Checkout'
          ></script>

Please Help.

Upvotes: 2

Views: 2756

Answers (1)

Anil Sharma
Anil Sharma

Reputation: 2962

I think you are using wrong API key . Check you publisher key . Mostly for this error 99% time it is wrong with Publisher Key.

Upvotes: 2

Related Questions