Hot File

Create integrate stripe payment gateway in Codeigniter ?

View: 2234    Dowload: 0   Comment: 0   Post by: hanhga  
Author: none   Category: Codeigniter   Fields: Other

8 point/5 review File has been tested

Stripe is one of the most powerful payment gateway for Web and Mobile payment

Introduction

Stripe is one of the most powerful payment gateway for Web and Mobile payment.

Integration of Stripe payment gateway using Codeigniter is very easy. Just follow few steps and it will be ready.
Stripe take care the processing and keeping client’s card data so no information of essence would be stored on our server and you would not have to comply with all the rules that come with storing credit/debit cards.Stripe is the easiest way to accept credit and debit card payments online. With Stripe, you can create exactly the payment experience you want in your website or mobile app, and we handle everything from security to daily transfers to your bank account.

First create a stripe account on https://dashboard.stripe.com/register After registration click on my account

stripe payment gateway in php

Once you click on the account setting  click on the app keys to get secret key and publishable key. You will see the screen below

stripe gateway in PHP

Now download the stripe library from GITHUB https://github.com/stripe/stripe-php/releases and place in the your libraries folder in codeigniter location(codeigniter/application/libraries) and rename the folder to Stripe.

Now create a file name stripe.php in the view folder and write down the below code

<!DOCTYPE html>
<html lang="en">
<body>
<div class='web'>
<form action="<?php echo site_url('Stripe_payment/checkout');?>" method="POST">
<script src="https://checkout.stripe.com/checkout.js"
class="stripe-button"
data-key="XXX_YOUR_PUBLISHER_KEY"
data-image="your site image"
data-name="w3code.in"
data-description="Demo Transaction ($100.00)"
data-amount="10000" />
</script>
</form>
</div>
</body>
</html>

Now create a controller name Stripe_payment.php and copy the following code :

<?php
defined('BASEPATH') OR exit('No direct script access allowed');
 
class Stripe_payment extends CI_Controller {
 
 public function __construct() {
 
 parent::__construct();
 
 }
 
          public function index()
         {
             $this->load->view(stripe);
          }
 
 public function checkout()
 {
 try { 
 require_once(APPPATH.'libraries/Stripe/lib/Stripe.php');//or you
 Stripe::setApiKey("YOUR_SECRET_KEY"); //Replace with your Secret Key
 
 $charge = Stripe_Charge::create(array(
 "amount" => 10000,
 "currency" => "usd",
 "card" => $_POST['stripeToken'],
 "description" => "Demo Transaction"
 ));
 echo "<h1>Your payment has been completed.</h1>"; 
 }
 
 catch(Stripe_CardError $e) {
 
 }
 catch (Stripe_InvalidRequestError $e) {
 
 } catch (Stripe_AuthenticationError $e) {
 } catch (Stripe_ApiConnectionError $e) {
 } catch (Stripe_Error $e) {
 } catch (Exception $e) {
 }
 }
 
}

 

Create integrate stripe payment gateway in Codeigniter ?

Create integrate stripe payment gateway in Codeigniter ? Posted on 08-01-2016  Stripe is one of the most powerful payment gateway for Web and Mobile payment 1.6/10 2234

Comment:

To comment you must be logged in members.

Files with category

 
Newsletter Email

File suggestion for you

File top downloads

logo codetitle
Codetitle.com - library source code to share, download the file to the community
Copyright © 2015. All rights reserved. codetitle.com Develope by Vinagon .Ltd