WHMCS stripe pay plugin

whmcs-stripe-php

whmcs-stripe-php

Do you want to accept credit cards on your website and save users confusion and time? This credit card gateway extension for WHMCS lets you accept credit card payments directly on your website via Stripe payment gateway.

With this extension your customer can use their credit cards during the checkout process and Stripe.com handles the rest. This means a smoother experience for your users as they never have to leave your website for making payments.

This is a free and open source Stripe Payment Gateway for WHMCS that supports one time and recurring payments without ever having a credit card number hit your WHMCS server.

Overview :

Stripe pay payment gateway allows the WHMCS billing system to use Stripe’s one time and reoccurring payment gateway capabilities. Stripe provides the unique ability to take a client’s credit card information without ever having the client leave your site, but it also allows for credit card data to never get stored in or even pass through your own server, eliminating costly concerns over PCI compliance. This gateway for WHMCS is being released free for anyone, although it should still be considered in beta as there are likely still bugs to work out of it.

You can sign up for a Stripe account at https://stripe.com.

Stripe API version :

  1. Stripe API 4.12.0 (Release date 05/06/2017)
  2. A Stripe Elements integration with js version v3

Requirements :

  1. PHP 5.3.3 and later.
  2. WHMCS (V7.X, V6.X)
  3. cURL must be enabled (This is most likely already enabled on your server, but you can contact your hosting provider if you are unsure)
  4. SSL certificate installed (in order to process live transactions)
  5. Stripe merchant account

Instructions For Use :

  1. Copy the file in the repository’s root folder called stripe.php and place it into the /modules/gateways/ folder of your WHMCS installation.
  2. From within the callback folder of the repository, copy the other stripe.php file and place it into the /modules/gateways/callback folder of your WHMCS installation.
  3. Copy the ccpay.php file from the repository into the root directory of your WHMCS installation.
  4. Finally, copy the clientareacreditcard-stripe.tpl file into the root level of the theme folder you are currently using for WHMCS. For example, if you’re using the default theme, then copy this file to /templates/default/.
  5. Add a webhook in Stripe to https://yourwhmcsinstall.com/modules/gateways/callback/stripe.php.

In the end, your folder structure should look roughly like the diagram below, with a ccpay.php file in the root of your install, a stripe.php in /modules/gateways/callback, a stripe.php in /modules/gateways/, a clientareacreditcard-stripe.tpl in the root of your WHMCS active template folder, and the lib folder of the Stripe API in the newly-created /modules/gateways/stripe/ folder.

You may now activate this new payment gateway from within WHMCS through the Setup > Payments > Payment Gateways screen. This module should be listed as Stripe. You can then fill in the appropriate API key information as well as a required email address where the gateway can send you any serious errors that come up while billing clients or communicating with Stripe.

To download source code Click here !!!

Fork on Github

Support Information :

I’m always looking to improve this code, so if you see something that can be changed or if you have an idea for a new feature or any other feedback, send me an email to sagasdeshmukh91@gmail.com, or send me a message on Twitter (@starsagar91), and I’ll get right back to you. If you decide to use this module in your WHMCS install, send me a message to say hello (and let me know what you think too) and it’ll make my day. Thanks!

How do MySQL indexes work?

What is MySQL indexes ?

A database index is a data structure that improves the speed of operations in a table. Indexes can be created using one or more columns, providing the basis for both rapid random lookups and efficient ordering of access to records.

How do MySQL indexes work?

Basically an index on a table works like an index in a book (that’s where the name came from):

Let’s say you have a book about databases and you want to find some information about, say, storage. Without an index (assuming no other aid, such as a table of contents) you’d have to go through the pages one by one, until you found the topic (that’s a full table scan). On the other hand, an index has a list of keywords, so you’d consult the index and see that storage is mentioned on pages 113-120,231 and 354. Then you could flip to those pages directly, without searching (that’s a search with an index, somewhat faster).

Of course, how useful the index will be, depends on many things – a few examples, using the simile above:

  • if you had a book on databases and indexed the word “database”, you’d see that it’s mentioned on pages 1-59,61-290, and 292 to 400. In such case, the index is not much help and it might be faster to go through the pages one by one (in a database, this is “poor selectivity”).
  • For a 10-page book, it makes no sense to make an index, as you may end up with a 10-page book prefixed by a 5-page index, which is just silly – just scan the 10 pages and be done with it.
  • The index also needs to be useful – there’s generally no point to index e.g. the frequency of the letter “L” per page.

Basic Linux Commands

              When dealing with the Linux operating system, commands are required as inputs to inform or direct a computer program to perform a specific operation. Understanding the most basic Linux commands will allow you to successfully navigate directories, manipulate files, change permissions, display information such as disk space, and more. Obtaining basic knowledge of the most common commands will help you easily execute tasks via the command line.

 

Below are the Some of basic linux commands:

ls = If you run ls without any additional parameters, the program will list the contents of the current directory in short form.

ls -l = detailed list

ls -a = displays hidden files
cp = Copies sourcefile to targetfile.
cp -r = Copies recursively (includes subdirectories)
mv = Copies sourcefile to targetfile then deletes the original sourcefile.
mv -b = Creates a backup copy of the sourcefile before moving
rm = Removes the specified files from the file system. Directories are not removed by rm unless the option -r is used.
rm -r = Deletes any existing subdirectories
rmdir = Deletes the specified directory, provided it is already empty.
cd = Changes the current directory. cd without any parameters changes to the user’s home directory.
mkdir = Creates a new directory.
cat = The cat command displays the contents of a file, printing the entire contents to the screen without interruption.
cat -n = Numbers the output on the left margin
less = This command can be used to browse the contents of the specified file. Scroll half a screen page up or down with PgUp and PgDn or a full screen page down with Space. Jump to the beginning or end of a file using Home and End. Press Q to exit the program.
grep = The grep command finds a specific searchstring in the specified file(s). If the search string is found, the command displays the line in which the searchstring was found along with the file name.
df = The df (disk free) command, when used without any options, displays information about the total disk space, the disk space currently in use, and the free space on all the mounted drives. If a directory is specified, the information is limited to the drive on which that directory is located.
df -h = shows human readable output of disk usage
du = This command, when executed without any parameters, shows the total disk space occupied by files and subdirectories in the current directory.
du -sh = Shows current folder size
du -sh * = List files/folders with their size in current folder
free = The command free displays information about RAM and swap space usage, showing the total and the used amount in both categories.
free -m = Shows output in human readable format
date = This simple program displays the current system time. If run as root, it can also be used to change the system time. Details about the program are available in date.
top = top provides a quick overview of the currently running processes. Press H to access a page that briefly explains the main options to customize the program.
kill = [You can kill processes which are executed only by you] Unfortunately, sometimes a program cannot be terminated in the normal way. However, in most cases, you should still be able to stop such a runaway program by executing the kill command, specifying the respective process ID (see top and ps).
kill sends a TERM signal that instructs the program to shut itself down. If this does not help, the following parameter can be used:
kill -9 = [You can kill processes which are executed only by you] Sends a KILL signal instead of a TERM signal, with which the process really is annihilated by the operating system. This brings the specific processes to an end in almost all cases.
ping = The ping command is the standard tool for testing the basic functionality of TCP/IP networks. It sends a small data packet to the destination host, requesting an immediate reply. If this works, ping displays a message to that effect, which indicates that the network link is basically functioning.
passwd = Users may change their own passwords at any time using this command. Furthermore, the administrator root can use the command to change the password of any user on the system.
clear = This command cleans up the visible area of the console. It has no options.

 

Useful options
——————–
mv -f force move by overwriting destination file without prompt
mv -i interactive prompt before overwrite
mv -u update – move when source is newer than destination
mv -v verbose – print source and destination files
man mv/info mv help manual

 

List the commands to display the contain of files

head, tail, cat less, more etc

eg.  $ cat file_name.txt

For more details check below links –

Hope the above article is helpful for you !

Stripe API implementation error/exception handling

Stripe error handling

Stripe error handling

Stripe API libraries raise exceptions for many reasons, such as a failed charge, invalid parameters, authentication errors, and network unavailability. The Stripe recommends for writing code that gracefully handles all possible API exceptions.

Below Error Handling code is compatible with latest stripe API version

 

For old stripe versions i.e Stripe API v1.18.0 use below Error Handling code

For more details please check .

 

What is different between abstract class and interface in PHP?

1) – For abstract class a method must be declared as abstract. Abstract methods doesn’t have any implementation.
– For interface all the methods by default are abstract methods only. So one cannot declare variables or concrete methods in interfaces.

2) – The Abstract methods can declare with Access modifiers like public, internal, protected. When implementing in subclass these methods must be defined with the same (or a less restricted) visibility.
– All methods declared in an interface must be public.

3) – Abstract class can contain variables and concrete methods.
– Interfaces cannot contain variables and concrete methods except constants.

4) – A class can Inherit only one Abstract class and Multiple inheritance is not possible for Abstract class.
– A class can implement many interfaces and Multiple interface inheritance is possible.

5) – Abstract class can contains constructor
– Interfaces cannot contain constructor

6) – Only complete member of abstact class can be static
– Member of interface can not be static

How to Copy directory/files from windows command line/prompt

COPY – It will allow you to quickly copy files from one location to another location.

Syntex > copy source_file_name destination_file_name

XCOPY – The xcopy command allows you to copy files and directories from one location to another location. This makes it much more suitable for copying folders. xcopy also has many modifiers which gives advanced users more control over the copying process.

Syntex > xcopy /E /I source_dir_name destination_die_name

Reference of /E and /I
/E – This option makes sure that empty subfolders are copied to the destination.
/I – Avoids prompting if the destination is a folder or file.

How can I offer a gzipped csv file for download using PHP?

Question:

I have a PHP script that creates  csv file from the db. I would like to have the script to create the csv data and immediately make a .gzip file available for download. Can you please give me some ideas?

Answer:

You can easily apply gzip compression with the gzencode function.

 

Stripe Payment gateway integration in PHP with DEMO Examples

Stripe payment gateway integration

Stripe payment gateway integration

Stripe payment gateway offers 2 ways of integration in PHP –

  • Stripe checkout integration
  • Stripe custom integration (Stripe.js)

Strip checkout integration:

The easiest way to integrate Stripe is via Checkout, an embedded tool that takes care of building an HTML form, validating user input, and securing your customers’ card data. Using Checkout, sensitive credit card information is sent directly to Stripe, and does not touch your server. Stripe returns to your site a token representation of the card, and this token can then be used in a charge request.

Embedding Checkout in your site

To get started, add the following code to your payment page:

Stripe Checkout Demo

Reference link : https://stripe.com/docs/checkout/tutorial

Stripe custom integration (Stripe.js):

For a more custom approach, you can instead use Stripe with your own payment form via Stripe.js.

Processing payments with Custom Stripe integration has two components:

Below code example show you demonstrate you the custom stripe integration with stripe.js.

Demo Link

You can download all above demos from below link :
Download Source Code

Or

Browse source code in github : https://github.com/sagarsdeshmukh/Stripe_gateway_integration_demo_with_PHP

If you have any additional questions Or queries, don’t hesitate to let me know!, Just put comment below or contact @ my mail id sagarsdeshmukh@gmail.com

Hope you enjoy my post :)

Bootstrap – Accordion Inside Accordion Example

Bootstrap-Accordion-Inside-Accordion_nested-Accordion_demo

Bootstrap-Accordion-Inside-Accordion_nested-Accordion_demo

Demo

Braintree Hosted Fields integration with Custom Stylesheet(css) and validation

Braintree-Hosted-Fields-custom-css-validation-Demo

Braintree hosted field integration offer great flexibility in customization of payment form design with custom style sheet (css) and validation error handling. You can change complete look and feel of your payment form as per site theme with hosted fields solution and it being so easy to do.

We will have example of custom design of payment form below in that we added auto payment method detection logic with braintree on the basis of card number as well as added error handing style on form fields.

With this script you can handle/ Manage full form validation with braintree internal card validation too.

Custom design mock-up :

Braintree-Hosted-Fields-custom-css-validation-Demo

Validation error handling :

Braintree-Hosted-Fields-Demo-custom-validation-style

You can edit the all style content in below script as per your requirement-

 

hosted_field_style.css

 

hosted_field_style.js

 

You can download full script from here.

For any queries regarding above script put comments below or reach me vie mail  – sagarsdeshmukh91@gmail.com