Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Domain Voucher Key Features (Introduced in v2.8)

  • Renewal voucher for existing domains
  • Each domain voucher is map to a specific domain extension in WHMCS
  • Can be used without Gift Card mode

Configuration

Enabling Domain Voucher Mode

To enable Domain Voucher Mode, go into your WHMCS Addon Modules → Gift Card Admin Module → Configure → Domain Voucher Status

Templates Used

New additional templates use for Voucher Mode are the following

Template file nameFunction

gcDomainVoucherIndex_horizontal.tpl

The horizontal voucher listing template

gcDomainVoucherIndex.tpl

The vertical voucher listing template

gcDomainVoucherIndexOrder.tpl

The checkout page for voucher purchases

gcDomainVoucherRedeem

The redemption page for vouchers

gcRedeem.tpl

The common page for checking a gift card/voucher code

gcDVCManage.tpl

The manage voucher page under a user within the client area

Creating a Domain Voucher for Sale

To put a voucher up for sale, first you must create a New Domain Voucher Mapping. 

Head to WHMCS → Addons → Gift Card Admin Module 

Then click on the Domain Voucher Management tab and Create New Voucher Mapping

On the next screen, you will be able to fill in the fields to create a new mapping

Domain Voucher Mapping Options

Option NameExplanation
Voucher NameThe display name of the Voucher
Voucher Mapping (Extesnion)The domain extension this type of voucher will be mapped to. The extension must be active in WHMCS
Voucher TypeRenewal
Registration/Renewal LengthThe renewal length to add onto the domain
Voucher ValueThe display value of the voucher. No bearing of the price
Voucher PriceThe selling price of the voucher
EnableEnable the selling of this voucher type
Show on Voucher Listing IndexIf disabled, the voucher will not be visible on the listing but users will still be able to purchase
ValidationRequire user to perform validation before the voucher is provisioned
Validation ConditionThe condition which the module will require the user to perform a validation on new voucher orders
Allow Self UserAllow the purchaser of the voucher to redeem the voucher
Personalized Message (Email)Allow the purchaser of the voucher to send a personalized message when sending the voucher to a friend
Code LengthThe length of the voucher code
PrefixThe prefix to add in front of the voucher code during generation
Code StyleThe allowed characters in the voucher code
Code CombinationThe style of how the code is divided
ExpiryThe amount of time the voucher will go expire after activation 
Restriction GroupThe restriction group which is allow to purchase & redeem the voucher
Voucher DescriptionThe description of the voucher shown on the listing index

Click on Add to Listing to add this domain voucher to your domain voucher listing.

You will find current Voucher Mappings for your system under the Voucher Management tab as well. 

Image RemovedImage Added

Click on the bubble and it will expand the properties for the particular Domain Voucher Mapping

Info
titleNote

You will not be able to delete a Domain Voucher Mapping if there is an existing Domain Voucher under it.

Operations

Buying

Your users can purchase a voucher by going to index.php?m=giftcard&action=indexvoucherindexdomainvoucher of your WHMCS. You can simply enable the Menu options under the Module's config.

Image RemovedImage Added

Redemption

Once the user have an active voucher, they can goto index.php?m=giftcard&action=redeemgc of your WHMCS or click on the Gift Cards & Vouchers Redemption link in the menu above.

Advance Voucher Redemption Guide

Info
titleNote

We will not be providing support for any custom coding due to the complexity.

Part 1 - Template front end

If your WHMCS product require additional user input before it is provisioned, then you will need to add additional fields manually to the template.

To do this, open the  gcVoucherRedeem.tpl template. To add a new field, look at the codes under IF statement of

Code Block
languagexml
{if $data["type"] == 0}

{elseif $data["type"] ==1}

You may copy and paste and use the existing code such as 

Code Block
languagexml
<input type="hidden" id="requiredinputtype" value="1"/>
                                <div class="col-sm-12">
                                    <div class="form-group row">
                                        <label for="requiredinput-host" class="col-sm-2 col-form-label">{$ADDONLANG.gcPage_redeem_vc_requiredinput_1}</label>
                                        <div class="col-sm-10">
                                            <input type="text" class="form-control" id="requiredinput-host" placeholder="hostname">
                                        </div>
                                    </div>
                                </div>

Change the id so that you can distinguish it during PHP processing and Javascript validation

If you need this required input to show up with Hostname input, then put in the (["requiredinput"] == 1) condition. If show up with FQDN input, then put it in the (["requiredinput"] == 2) condition. For IP input, put it in the (["requiredinput"] == 3) condition.

If you need this required input to show up for all vouchers, then you need to create a new IF condition within the ({if $data["type"] == 0}) condition, and a ({else}) condition. 

For example,

Code Block
languagexml
                           {if $data["data"]["properties"]["requiredinput"] == 1}
                             <input type="hidden" id="requiredinputtype" value="1"/>
                                <div class="col-sm-12">
                                    <div class="form-group row">
                                        <label for="requiredinput-host" class="col-sm-2 col-form-label">{$ADDONLANG.gcPage_redeem_vc_requiredinput_1}</label>
                                        <div class="col-sm-10">
                                            <input type="text" class="form-control" id="requiredinput-host" placeholder="hostname">
                                        </div>
                                    </div>
                                </div>
                            {elseif $data["data"]["properties"]["requiredinput"] == 2}
                                <input type="hidden" id="requiredinputtype" value="2"/>
                                <div class="col-sm-12">
                                    <div class="form-group row">
                                        <label for="requiredinput-fqdn" class="col-sm-2 col-form-label">{$ADDONLANG.gcPage_redeem_vc_requiredinput_2}</label>
                                        <div class="col-sm-10">
                                            <input type="text" class="form-control" id="requiredinput-fqdn" placeholder="domain.com">
                                        </div>
                                    </div>
                                </div>
                            {elseif $data["data"]["properties"]["requiredinput"] == 3}
                                <input type="hidden" id="requiredinputtype" value="3"/>
                                <div class="col-sm-12">
                                    <div class="form-group row">
                                        <label for="requiredinput-ip" class="col-sm-2 col-form-label">{$ADDONLANG.gcPage_redeem_vc_requiredinput_3}</label>
                                        <div class="col-sm-10">
                                            <input type="text" class="form-control" id="requiredinput-ip" placeholder="1.2.3.4">
                                        </div>
                                    </div>
                                </div>
                             {else}
								**Your new codes
                            {/if}

If you need the required input to show up for a particular voucher mapping then you can perform a IF condition such as 

Code Block
languagexml
{if $data["data"]["id"] == X}

{/if}

Where X is the voucher's ID. 

Once you have added the fields, you may want to add additional Javascript validation.

Part 2 - PHP Backend

Warning
titleWarning!

Do not allow user input without running some sort of validation of user's input. 

You will want to run some validation in the backend before it is inserted into your database. To do this, open the following file

Code Block
languagetext
modules/servers/giftcardprovision/include/processhookVC.php
This file is not encoded. Therefore you can make any changes you need for New Service redemption that require additional user input.
The codes are in the redemptionProcessHook function. 

You can refer to the WHMCS AddOrder API guide for additional information.

That's it. You new codes should be running for your new inputs.

Running codes after successful Renewal Redemption

If you run any custom code after a user successfully redeemed a voucher, simply open the following file.

Code Block
languagetext
modules/servers/giftcardprovision/include/processhookVC.php

then you can insert your own code in the redemptionRenewalHook function.

The $vars variable contains the following

Code Block
languagephp
$vars = array("uid"=>$_SESSION['uid'],"vcdata"=>$vcdata);

$vcdata are the voucher's properties which you can locate it in the mod_giftcard_voucher table in the database

$serviceid is the service id of the user chose to extend the renewal to.



Table of Contents
maxLevel3
minLevel2
absoluteUrltrue