CodeIgniter Stripe Payment Gateway Api Integration

CodeIgniter Stripe Payment Gateway Api Integration

In this Post We Will Explain About is CodeIgniter Stripe Payment Gateway Api Integration With Example and Demo.Welcome on – Examples, The best For Learn web development Tutorials,Demo with Example! Hi Dear Friends here u can know to Stripe payment gateway integration – Codeigniter – PHP Example

In this post we will show you Best way to implement Integration Stripe payment gateway in codeigniter, hear for Create integrate stripe payment gateway in Codeigniterwith Download .we will give you demo,Source Code and examples for implement Step By Step Good Luck!.

Stripe Payment API integration in CodeIgniter

Stripe is simple and one of the most powerful secure payment gateway for Web-application and Mobile payment.

Read Also:  Vue js Laravel Image Upload Example Tutorial From Scratch

Now you can download the stripe PHP library from here GITHUB Download and place in the your directory libraries directory in PHP codeigniter location Like as a(codeigniter/application/libraries) and rename the directory to Stripe.

stripe payment gateway in php

Once we click on the create account setting as well as click on the simple app keys get to get secret key and config and simple put publishable key. we will see simple the screen source code below

stripe gateway in PHP

And then create a new file name like as a stripe.php in the view HTML Directory and simple put down the Like this below source code.

Read Also:  Laravel Logging an Array Example

<span style="font-size:12px;"><span style="font-family:arial,helvetica,sans-serif;"><!DOCTYPE html>
<html lang="en">
<div class='web'>
<form action="<?php echo site_url('Stripe_payment/checkout');?>" method="POST">
<script src=""
data-description=" ($100.00)"
data-amount="485265" />

Now simple create a new controller name Stripe_payment.php and then copy the following simple source code Below:

<span style="font-size:13px;"><span style="font-family:arial,helvetica,sans-serif;"><?php
defined('BASEPATH') OR exit('No direct script access allowed');
//in controller  
class Stripe_payment extends CI_Controller {
 //in __construct
 public function __construct() {
  //call routing First index function using CI
          public function index()
 public function checkout()
	 require_once(APPPATH.'libraries/Stripe/lib/Stripe.php');//or we
	 Stripe::setApiKey("YOUR_SECRET_KEY"); //create new app to Replace with your stripe Secret Key
	 //pass param to create a user 
	 $charge = Stripe_Charge::create(array(
	 "amount" => 10000,
	 "currency" => "usd",
	 "card" => $_POST['stripeToken'],
	 "description" => "Demo Live24u"
	 echo "<h1> - > Your payment has been completed.</h1>"; 
  //catch part
 catch(Stripe_CardError $e) {
	 // Since it's a decline, \Stripe\Error\Card will be caught
		  $body = $e->getJsonBody();
		  $err  = $body['error'];

		  print('Status is:' . $e->getHttpStatus() . "\n");
		  print('Type is:' . $err['type'] . "\n");
		  print('Code is:' . $err['code'] . "\n");
		  // param is '' in this case
		  print('Param is:' . $err['param'] . "\n");
		  print('Message is:' . $err['message'] . "\n");
	 catch (Stripe_InvalidRequestError $e) {
	 catch (Stripe_AuthenticationError $e) 
	 catch (Stripe_ApiConnectionError $e) 
	 catch (Stripe_Error $e) 
	 catch (Exception $e) 


Read Also:  PHP mysqli insert update delete for Dynemic query

I hope you have Got What is php – Stripe payment gateway integration in codeigniter And how it works.I would Like to have FeadBack From My Blog( readers.Your Valuable FeadBack,Any Question,or any Comments abaout This Article( Are Most Always Welcome.