Tech Arise

Stripe Payment Gateway Integration in Codeigniter using cURL

Stripe is the popular payment Gateway. Stripe Payment Gateway clean, fast, secure payments services and a powerful way to accept credit cards directly on the web application and Developer Friendly API.
In this post, We have share how to integrate Stripe payment gateway using Codeigniter. This is a very simple example, you can just copy paste, and change according to your requirement.
Follow some basic Steps Stripe payment gateway
Step-1: Create a Stripe account and get API keys
Before started to implement the Stripe Payment Gateway Integration in Codeigniter, look files structure:
Step-2: Create MySQL Database and Table
1- product table
2- orders table
Open application/config/autoload.php file and add/update code like as bellow:
Step-3: Define constants
Update file named constants.php inside “application/config/” folder.
Open application/config/database.php file and add constants like as bellow:
Step-4: Create a controller file
Create a controller file named StripePayment.php inside “application/controllers” folder.
Step 2: Create a model file
Create a model file named Payment_model.php” inside “application/models” folder.
Open application/config/routes.php file and add code like as bellow:
Step-5: Stripe Token and Validate Card with Stripe.js:
Step-6: The following JavaScript code is used to generate token with “Stripe.js” library.
Step 7: Create a view(header)
Create a view file named header.php inside “application/views/templates” folder
This view contains the header section of the webpage. The Bootstrap library is used to provide a better UI, so, include it in the header section.
Step 8: Create a view(footer)
Create a view file named footer.php inside “application/views/templates” folder
This view contains the footer section of the webpage.
Step 8: Create a view(index)
Create a view file named index.php inside “application/views/stripe” folder.
Step 9: Create a view(checkout)
Create a view file named checkout.php inside “application/views/stripe” folder.
Step 9: Create a view(success)
Create a view file named success.php inside “application/views/stripe” folder

Exit mobile version