0
votes

I integrate a stripe payment gateway in my Codeigniter project. While payment it redirects to the success page but the amount was not detected from my card and not listed in my stripe dashboard, please help me.

stripecontroller

 public function stripePost()
{
    require_once('application/libraries/stripe-php/init.php');

    \Stripe\Stripe::setApiKey($this->config->item('stripe_secret'));
 
    \Stripe\Charge::create ([
            "amount" => $this->input->post('amount'),
            "currency" => "usd",
            "source" => $this->input->post('stripeToken'),
            "description" => "Test payment gateway integration." 
    ]);
        
    $this->session->set_flashdata('success', 'Payment made successfully.');
         
    redirect('/payment/method', 'refresh');
}

I stored my key in config.php

$config['stripe_key'] = '********************************';

$config['stripe_secret'] = '****************************';

Please help. Thanks in advance

1
How do identify if a charge is successful? You will need to check the error Stripe throws when attempting a charge to get an idea what is happening behind the scenes. Read their API docs. - Manish Pareek

1 Answers

1
votes

You should be using your Test API keys and Test card numbers, not live ones. Assuming you're using your API keys, and there were no errors, then the Charge should be created in your Stripe Account.