Welcome! Get familiar with the Gift Card Application. Simplify your gift card operations with this user-friendly Gift Card Application, Backed by Google Sheets. This application provides an efficient and hassle-free way to create, manage, and track gift cards. Perfect for businesses of all types, it’s easy to install and customize, making it a versatile tool for enhancing customer engagement.
With this application, businesses can offer discounts based on card types, fostering customer loyalty and encouraging repeat visits. Whether you're running a retail shop, restaurant, or service-based business, this solution will streamline your processes while delighting your customers. Get started today and watch your business grow!
Created : 20/02/2021
By : Jawad Ali Jamil
Thank you for purchasing Gift Cards Application. If you have any questions that are beyond the scope of this help file, please feel free to email hi@jawadalijamil.com or via my user page contact form. Thankyou so much!
Application Features
Multi-User Access
Multi-Branch Support
Card Redemption with Discounts
Card Top-Up
Block Lost or Stolen Cards
Customizable Card Types
User Management
Comprehensive Log Sheets
Installation
To set up the code, you need to prepare the Google Sheet and ensure all required information is ready, including the `credentials.json` file. Grant the necessary permissions to the Google Sheet, allowing it to interact with the code seamlessly. This setup ensures proper integration and functionality between the application and the Google Sheet.
Basic Configuration
To configure the application, update the necessary settings in the include/config.php file.
Navigate to APIs & Services > Library, and enable the Google Sheets API and Google Drive API.
Create a Service Account:
Go to APIs & Services > Credentials, and click Create Credentials.
Select Service Account, and complete the setup process.
Download credentials.json File:
After creating the service account, go to the service account's details.
Under the Keys section, create a new key and select JSON format.
Download the credentials.json file and replace it with the empty credentials.json file in your project directory.
Share Your Google Sheet with the Service Account:
Open your Google Sheet and click Share.
Add the service account's email address (found in the credentials.json file) with Editor access.
Service account email will look something like this ******@************.gserviceaccount.com
Update Configuration:
Add the spreadsheet_id (found in the Google Sheet URL) to your config.php file.
A spreadsheet ID can be extracted from its URL, For example, the spreadsheet ID in the below given url URL https://docs.google.com/spreadsheets/d/1hXVZ-B6USf1l98Rd9-Zk0lw/edit#gid=0 is "1hXVZ-B6USf1l98Rd9-Zk0lw"
Ensure the credentials.json file path is correctly referenced in your application code.
Your Google Sheet is now ready to interact with the application.
Import Demo Data
Instructions to Import Demo Data Sheet into Google Sheets. To continue with the setup, you'll need to import a sample demo data sheet into the new empty Google Sheet you created in the previous step. Follow the steps below:
Download the Demo Data Sheet:
Click the link below to download the sample demo data sheet:
Go to the Google Sheets tab where you created the new, empty sheet.
Import the Demo Data:
In your empty Google Sheet, click on File > Import.
In the Import window, choose the Upload tab.
Drag and drop the downloaded demo data sheet file or click Select a file from your device to browse and select the downloaded file.
Choose Import Settings:
In the import options, select Replace current sheet if you want to replace the existing empty sheet with the demo data.
Ensure the other import options are set according to your preference (e.g., Detect automatically for separator type).
Click Import data to complete the process.
Review the Imported Data:
Once the import is complete, you should see the demo data populated in your Google Sheet.
Ensure the data is correctly structured according to your project requirements.
You can now proceed with the setup using the demo data in your Google Sheet.
Setting Up Cron Jobs
A cron job is an automated task that runs at specific intervals. In this case, we will use a cron job to automatically execute a PHP script on your server every hour. This is useful for tasks like updating card statuses, processing background tasks, and more, without manual intervention.
The cron job you are setting up will specifically check the status of cards, including their expiry and blocking. This ensures that the cards in your system are always up to date, and their statuses are correctly reflected. It will automatically:
Check if any cards have expired and update their status to "Expired".
Check if any cards have been blocked and update their status accordingly.
Update the card status to "Active" if it is neither expired nor blocked.
Follow the instructions below to set up a cron job. In the Command field, enter one of the following commands based on your server configuration:
The cron job will automatically execute the script located at /processor/corn.php every hour. This script is essential for ensuring your system runs smoothly by automatically updating card statuses, checking expiry, and handling blocked cards without requiring manual action from you.
Important: Replace your-domain.com with your actual domain name in the above commands.
If you don't know how to set up cron jobs on your server, you can check your hosting control panel for a cron job section, or contact your hosting provider's support for assistance. Setting this up ensures that critical tasks will run on time, helping you maintain the functionality of your application efficiently.
Tutorial
Demo Data
How to create and import demo data to google sheet?
Setup project in Google Console
In this video you will learn how you can easily setup and create a new project in Google Cloud Console while setting up your Gift Card Application.
How to enable required Google API?
In this video, you'll learn how to enable the Google Sheets and Google Drive APIs for setting up your Gift Card Application. You will also learn how to get credentials.json file after creating a key in Google console.
How to share Google sheet with Service Account Email?
In this video, you'll learn how to share Google Sheet with google service account email for setting up your Gift Card Application.
How to get Google sheet ID?
In this video you will learn how to get the Google sheet ID which you have to paste in config.php file while setting up the Gift Card Application.
Sources And Credits
Fonts Used in this documents are google fonts, you can find them on Google Fonts API. Tutorial videos are hosted on youtube, You can find the youtube channel link below:
Once again, thank you so much for purchasing this code. As I said at the beginning, I'd be glad to help you if you have any questions relating to this code. No guarantees, but I'll do my best to assist. If you have any queries, please feel free to contact me from my Profile.