Table of Content
- Extension Installation Guide
- Twilio Registration
- Msg91 Registration
- Textlocal Registration
- Adding a New Gift Card Product
- Configuration
- Email Notification Settings
- SMS Notification Settings
- Gift Card Product in Frontend
- Gift Card Accounts Grid in Backend
- Gift Card Redemption from Frontend
- Applied Gift Card Orders Grid in Backend
- Find the Composer name and version of the extension in the extension’s composer.json file.
- Login to your SSH and run:
- composer require meetanshi/magento2-gift-card --ignore-platform-reqs
- composer require twilio/sdk
- Enter your authentication keys. Your public key is your username; your private key is your password.
- Wait for Composer to finish updating your project dependencies and make sure there aren’t any errors.
- To verify that the extension is installed properly, run the command:
- php bin/magento module:status Meetanshi_GiftCard --ignore-platform-reqs
-
- By default, the extension is probably disabled.
- Enable the extension and clear static view files:
-
- php bin/magento module:enable Meetanshi_GiftCard --clear-static-content
- php bin/magento setup:upgrade
- For Magento version 2.0.x to 2.1.x - php bin/magento setup:static-content:deploy
- For Magento version 2.2.x & above - php bin/magento setup:static-content:deploy –f
- php bin/magento cache:flush
- php bin/magento module:status Meetanshi_GiftCard --ignore-platform-reqs
Note: Don’t forget to install Twilio library if you are using Twilio SMS gateway for our extension.
- Twilio Registration
If you are going to use Twilio as an SMS gateway to send Gift Card SMS notifications, you need to register with the Twilio to get Account SID, Auth Token and Twilio Phone Number.
-
- First of all, Sign Up for the Twilio account. Add the details and click to get started.
- First of all, Sign Up for the Twilio account. Add the details and click to get started.
-
- After the Email verification, enter your mobile number and click to “Verify”.
-
- Once you click “Verify”, you will get an OTP on the added mobile number. Enter the OTP and verify the mobile number. Now move to Settings à General where you can see API details both for live and testing. Copy the Account SID and Auth Token to use them in Magento backend configuration for Twilio account.
- Once you click “Verify”, you will get an OTP on the added mobile number. Enter the OTP and verify the mobile number. Now move to Settings à General where you can see API details both for live and testing. Copy the Account SID and Auth Token to use them in Magento backend configuration for Twilio account.
-
- Now, click three dots from the left sidebar, go to Programmable SMS and click Build under the Learn and Build option. From here, you can get Twilio phone number to use for sending the SMSs. Click on the “Get a number” button.
- Now, click three dots from the left sidebar, go to Programmable SMS and click Build under the Learn and Build option. From here, you can get Twilio phone number to use for sending the SMSs. Click on the “Get a number” button.
-
- You will get a number to choose. Click “Choose This Number”.
- You will get a number to choose. Click “Choose This Number”.
- Once you click the button, you will get a Twilio phone number. Copy this number and set it in the Magento backend configuration for Twilio account.
- Msg91 Registration
The extension allows configuration of the Msg91 SMS gateway to send Gift Card SMS notifications. If you choose to use Msg91 SMS gateway integration, follow the steps below to get sender ID and API key.- Visit https://control.msg91.com/signup/. Enter the details and click to sign up.
- Visit https://control.msg91.com/signup/. Enter the details and click to sign up.
-
- You will get and code or a magic link in the Email to verify the Email address.
- You will get and code or a magic link in the Email to verify the Email address.
-
- You will be asked to enter the mobile number for verification.
-
- Enter the OTP to verify the mobile number and you will be registered successfully. Login with the credentials.
- Enter the OTP to verify the mobile number and you will be registered successfully. Login with the credentials.
-
- Under the settings, you can find the Sender ID which you need to copy and paste in the Magento configuration.
-
- Now move to API, where you can find the API key for the Magento configuration.
- Now move to API, where you can find the API key for the Magento configuration.
- You can find the Message type under the Send SMS tab. Select the SMS type in Msg91 configuration in Magento as per your requirement.
Note: If you are an Indian user of our Magento 2 Gift Card extension with Msg91 API, don’t forget to follow DLT registration process and get your DLT templates approved for each SMS. Once you get the DLT template ID, enter the same in the respective field in Magento 2 extension configuration.
- Textlocal Registration
The extension allows configuration of the Textlocal SMS gateway to send Gift Card SMS notifications. If you choose to use Textlocal SMS gateway integration, follow the steps below to get sender ID and API key.
- Create a Textlocal account from https://www.textlocal.in/signup/
- After the registration, you will get a verification link in your registered Email ID, clicking the link will land you to add additional information page. Here, add the account details and submit to activate your Textlocal account.
- Navigate to Settings > API Keys and create new key to use. Copy the created API Key and paste it in Magento 2 extension configuration.
- Now move to Settings > All Settings and click on “Sender Names” to get your sender name.
- You can copy your Textlocal sender name from here and paste it in Magento 2 extension configuration.
- Textlocal requires to create message template to send SMS notification. Go to Send > Templates & Drafts and click to create and request new SMS template.
- You have to create new message template for each SMS notification enabled in Magento 2 Gift Card extension configuration. Enter title, select category and sender name. Set message text same as SMS text in Magento 2 extension configuration notification settings. You have to create new SMS template in Textlocal for every enabled SMS notification in Magento 2. For example, if you have set “SMS Text for GiftCard Notification” from Magento 2 backend, create a message template for the same in Textlocal having exactly the same SMS text.
- For the dynamic values in text message input, click “Insert Restricted Template Items”. Click “Insert an Input Box” and it will open a popup to create new placeholder for the dynamic value. Add placeholder text name and set maximum length for the dynamic value. Insert it into the SMS text and while sending the message, this placeholder will match the variable in Magento 2 Gift Card notification text and replace it with the real value.
- Once message templates have been created and submitted for each Gift Card SMS notification, it will take approximately a week to be approved by the Textlocal. You can send Gift Card SMS notifications only after the message templates approved by the Textlocal.
- Adding a New Gift Card Product
Before configurating the extension you will need to add gift card as a new product. Login to Magento backend, move to Catalog à Products where you can find “Add Product” option to add products. Select the product type as “Gift Card” from the drop down.
- Make sure to add all related settings along with setting comma separated price range for gift card product.
- Configuration
To configure the extension, login to Magento backend, move to Stores à Configuration à Gift Card where you can find various settings to configure the extension.
- Gift Card: Enable the Gift Card extension from here.
- Gift Code Pattern Prefix: Enter prefix to add before auto generated gift code.
- Gift Code Pattern: Select one of the gift card code patterns.
- Numeric: Generates the code using numbers.
- Alphabetic: Generates the code using alphabets.
- AlphaNumeric: Generates the code using the mix of numbers and alphabets.
- Gift Code Length: Enter the gift code length in characters.
- Gift Code Expiry in Day(s): Enter no. of days after which you want the gift card to expire.
- Gift Code Expiry Notification To Customer Before Day(s): Enter no. of days before which you want to notify gift card receiver about gift card expiration.
- Email Notifications
- Email Sender: Select sender for the various email notifications.
- Email Template For Gift Card Notification: Select email template for new gift card received email notification to gift card receiver.
- Email Template For Gift Card Reminder Before Expired: Select email template for gift card expiry reminder to be sent based on the days added in configuration to gift card receiver.
- Email Template For Gift Card Expired: Select email template to notify gift card receiver about card expiration.
Email Notifications:
The Gift card receiver will receive Email notification as shown if the gift card sender has selected “Email” from the frontend while ordering the gift card.
- New Gift Card Received Email Notification to Receiver
- Gift Card Expiry Email Reminder to Gift Card Receiver
The Gift card receiver will be notified with Gift Card expiration reminder email if the gift card expiry is set from the configuration and is about to expire before the full usage.
- Gift Card Expiry Email Notification to the Gift Card Receiver
The Gift card receiver will be notified with email if the gift card has expired before the full usage.
To configure the extension to send Gift Card SMS notifications, move to Gift Card à Configuration à SMS Notification where you can find various settings to configure SMS Notifications.
- Enable SMS Notification: Enable gift card SMS notification from here.
- API Provider: Select one of the API providers from the drop down menu.
- Twilio
- Twilio SID: Enter your SID Number from the respective API provider account.
- Twilio Token: Enter the token from the API provider account here.
- Twilio Number: Enter your API account number here.
- Msg91
- Sender ID: Enter the sender ID received from Msg91.
- API Key: Enter the API key received from Msg91.
- API URL: Enter the API URL.
- Message Type: Select one of the message types as purchased from the Msg91.
- Textlocal
- Other: If you are going to use custom SMS API other than Msg91, Twilio or Textlocal, you have to add your CURL URL as below:
- Twilio
Format: https://yoursmsapi.com/sms/submitsms.jsp?user=yourusername&senderid=yoursenderid&key=yoursmskey&mobile={mobile}&message={msg}
Sample CURL URL:
https://foxxsms.com/sms/submitsms.jsp?user=METANSHI&senderid=FOXGLV&accusage=6&key=587e05afbcXX&mobile={mobile}&message={msg}
- SMS Text for GiftCard Notification: Enter the text you want to send for the gift card SMS notification.
- SMS Text for GiftCard Reminder Before Expired: Enter the text you want to send through SMS for reminding that the gift card is going to expire.
- SMS Text for GiftCard Expired: Enter the text you send through SMS for notifying that the gift card has expired.
SMS Notifications:
The Gift card receiver will receive SMS notification as shown if the gift card sender has selected “SMS” from the frontend while ordering the gift card.
- New Gift Card Received SMS Notification to Receiver
- Gift Card Expiry SMS Reminder to Gift Card Receiver
The Gift card receiver will be notified with Gift Card expiration reminder SMS if the gift card expiry is set from the configuration and is about to expire before the full usage.
- Gift Card Expiry SMS Notification to the Gift Card Receiver
The Gift card receiver will be notified with SMS if the gift card has expired before the full usage.
- Gift Card Product in Frontend
The customers can place order for gift card just like any other product. The same will be delivered virtually through mail/SMS whatever option is chosen.- Gift Amount: Select whatever amount or enter the gift card amount manually of which you want to purchase the gift card.
- Notification Info: Enter respective sender’s and receiver’s name.
- Sent Notification By: Select the one of the notification modes:
- Message: Add additional gift message for the receiver.
- Gift Card Notification Delivery Date: Select date when you want your gift card to be delivered to the receiver.
- My Gift Cards Tab in Customer Account Section in Frontend
Registered users can view purchased gift card details in their respective “My Account” section under “My Gift Cards” tab. They can also view various details like gift code, balance, status and expiry date.
- Gift Card Accounts Grid in Backend
The admin can view all the purchased gift card details from Gift Card à Gift Card Accounts. The grid shows the order number, gift card code, receiver’s name, email, status of the card, balance, used gift card amount and expiry date.
- Gift Card Redemption from Frontend
The receiver can redeem the gift card to purchase the products from the store in frontend. After adding the products to card, the gift card receiver can apply the gift code received through email/SMS on the cart page.
- Customers can apply gift code also from the checkout page. Paste the gift code and then click on apply gift code.
- Gift Card Redemption Details in My Order Section
If the gift card receiver has placed order after registration, he can see the gift card redemption details in his My Account section under “My Orders” tab.
- Applied Gift Card Orders Grid in Backend
The admin can view all the orders placed by gift card redemption in a separate grid in Gift Card à Applied Gift Card Orders. The grid shows the order ID, gift code used, customer name, email and used amount.