Hello Coders, we all know about Stripe payment gateway which is very secure and easy to implement in any language. If you want to integrate any payment gateway on very short steps than Stripe is best.

Today we will learn about how we integrate Stripe Payment Gateway in CodeIgniter and how to add customer’s or user’s card details to the stripe account and also how we provide access to the user how they delete the card details from the stripe.

Download Stripe Library

First, we download the CodeIgniter framework from www.codeigniter.com than download stripe library from link: https://github.com/stripe/stripe-php.

Setting API key on Code

On Codeigniter, you have to set API key on the path: application/config/config.php

You get those code from here, create an account on the stripe and open dashboard go to below picture path info.

After setup the API credentials you have to create route of stripe

application/config/routes.php

After that, you use below code on your controller for the further process where we save card details of particular user and also delete, check code below,

Main Points for Card detail process:

    1. First thing for saving new card details on stripe account of particular user you have to use CUSTOMER ID, I give you details about after the first payment of any user you can retrieve customer id using your database, on the time of first payment you store the payment data so from there you can retrieve the CUSTOMER ID.
    2. After getting customer ID, you can save the particular customer data using below code,

       
    3. On the above code we save the card details using PHP library of stripe and now we create a controller for how can any user can delete the card details from sripe accunt using this API. See the code below,

       

And now we completed both operations with Stripe API. I hope you will find useful thing on that post. If you have any query about programming thing please visit question panel for asking anything about your programming problem.

Happy Coding..!

 

Was this article helpful?
YesNo

By Bikash

My name is Bikash Kr. Panda. I own and operate PHPCODER.TECH. I am a web Programmer by profession and working on more than 50 projects to date. Currently I am working on the web-based project and all the CMS and frameworks which are based on PHP.

8 thoughts on “Stripe Payment API integration and Card save and delete operation in Codeigniter”
  1. Howdy! Someone in my Facebook group shared this site with us so I came to
    check it out. I’m definitely loving the information. I’m book-marking
    and will be tweeting this to my followers! Superb blog and great style and design. Hello would you mind letting me know which web host you’re utilizing?

    I’ve loaded your blog in 3 different web browsers and I must say this blog loads
    a lot quicker then most. Can you suggest a good internet hosting provider at a reasonable price?
    Many thanks, I appreciate it! You’ve made some decent points there.
    I looked on the internet for more information about the issue and
    found most individuals will go along with your views on this site.

  2. I really like what you guys tend to be up too. This sort of clever work and exposure!
    Keep up the fantastic works guys I’ve included you guys to my blogroll.
    I’ll immediately snatch your rss as I can’t in finding your e-mail subscription link or
    e-newsletter service. Do you’ve any? Kindly let me understand in order that I could subscribe.
    Thanks. I couldn’t resist commenting. Exceptionally well written! http://foxnews.net

  3. When someone writes an article he/she maintains the thought of
    a user in his/her brain that how a user can understand it.
    Therefore that’s why this paragraph is outstdanding.
    Thanks!

  4. When someone writes an article he/she keeps the idea of a user in his/her mind that how a user can know it.
    Therefore that’s why this paragraph is perfect.
    Thanks!

Leave a Reply

Your email address will not be published. Required fields are marked *