<PAGE>
 
                                                                   EXHIBIT 10.40

                 SECOND AMENDED AND RESTATED PLEDGE AGREEMENT


  This SECOND AMENDED AND RESTATED PLEDGE AGREEMENT (this "Agreement"), dated as
of August 17, 1998, is between TIER TECHNOLOGIES, INC. (the "Company") and
WILLIAM G. BARTON ("Barton").

  WHEREAS, on February 28, 1997, Barton entered into a promissory note payable
to the Company in the amount of $939,800, due February 28, 2007 (the "Note"),
secured by shares of Common Stock of the Company owned by Barton pursuant to a
pledge agreement dated as of February 28, 1997, as amended by the Amended and
Restated Pledge Agreement dated as of August 1, 1997 (the "Pledge Agreement");
and

  WHEREAS, pursuant to Section 11(b) of the Pledge Agreement, if, at the end of
any fiscal quarter, the Fair Market Value of the Pledged Collateral (as defined
therein) exceeds the balance due under the Note, upon the request of Barton, the
Company must release any excess collateral; and

  WHEREAS, Barton and the Company wish to amend and restate the Note and replace
it with a revised note (the "August 1998 Note") and to amend and restate the
Pledge Agreement in order to facilitate the operation of Section 11(b) thereof
and to secure the August 1998 Note with Class A Common Stock beneficially owned
by Barton:

  For good and valuable consideration and to secure the payment of Barton's
indebtedness to the Company, the parties agree as follows:

1. Barton's Indebtedness.
   --------------------- 
 
   (a) In connection herewith Barton has delivered the August 1998 Note, payable
to the order of the Company in an aggregate principal amount of nine hundred and
thirty-nine thousand, eight hundred dollars ($939,800.00).

   (b) In accordance with Section 11 hereof, the number of shares of Class A
Common Stock of the Company set forth on Schedule A hereto, which are currently
beneficially owned by Barton, shall serve as the security for the August 1998
Note (the "Shares").

   (c) Barton has executed the August 1998 Note and is required to secure the
August 1998 Note by delivery of this Agreement.

2. Pledge.  Barton hereby pledges to the Company, and grants to the Company a
   ------                                                                    
security interest in, the following (the "Pledged Collateral"):  (i) the Shares
and the certificates representing the Shares; and (ii) securities of the Company
associated with the Shares issued in connection with any stock dividend or stock
split, or securities of the Company issued in connection with a
recapitalization, merger, reorganization or similar transaction.

                                       1
<PAGE>
 
3. Security for Obligations.
   ------------------------ 

   (a) This Agreement secures the payment of all of Barton's present and future
obligations, duties and liabilities under the August 1998 Note and under this
Agreement (all referred to as the "Obligations").

   (b) This Agreement shall create a continuing security interest in the Pledged
Collateral and shall (i) remain in full force and effect until payment in full
of the Obligations; (ii) be binding upon Barton and his successors and assigns;
and (iii) inure to the benefit of the Company and its successors, transferees,
and assigns.

4. Delivery of Pledged Shares.  All certificates or instruments representing or
   --------------------------                                                  
evidencing the Shares shall be held by or on behalf of the Company under this
Agreement and shall be in suitable form for transfer by delivery, or shall be
accompanied by duly executed instruments of transfer or assignment in blank, all
in form and substance satisfactory to the Company.  If Barton fails to perform
any Obligation contained in this Agreement, the Company may itself perform, or
cause performance of, that Obligation, and the expenses of the Company incurred
in connection with that performance shall be payable by Barton under Section 9
hereto.

5. Representations and Warranties.  Barton represents and warrants as follows:
   ------------------------------                                             

   (a) Barton is the beneficial owner of the Pledged Collateral free and clear
of any lien on the Pledged Collateral except for the security interest created
by this Agreement and the other terms and conditions set forth in the Stock
Option Agreements.  The Pledged Collateral is held of record by the Tier
Technologies, Inc. Voting Trust.

   (b) The pledge of the Pledged Collateral under this Agreement creates a valid
and perfected first priority interest in the Pledged Collateral, securing the
payment of the Obligations.

   (c) No authorization, approval, or other action by, and no notice to or
filing with, any governmental authority or regulatory body is required either
(i) for the pledge by Barton of the Pledged Collateral under this Agreement or
for the execution, delivery, or performance of this Agreement by Barton; or (ii)
for the exercise by the Company of the voting or other rights provided for in
this Agreement or the remedies in respect of the Pledged Collateral under this
Agreement (other than restrictions under any federal or state securities law
applicable to the offer or sale of unregistered securities).

6. Rights in Absence of Default.
   ---------------------------- 

   (a) So long as there has been and is no Event of Default: (i) involving
failure to make the payment described in Section 2 of the August 1998 Note, or
(ii) involving the voluntary placement by Barton of a lien upon all or a
significant portion of the Pledged Collateral:

                                       2
<PAGE>
 
       (i)   Barton shall be entitled to exercise any and all voting and other
consensual rights pertaining to any or all of the Shares, subject to any other
agreement to which the Shares may be subject.

       (ii)  Securities of the Company associated with the Shares issued in
connection with any stock dividend or stock split, or securities of the Company
issued in connection with a recapitalization, merger, reorganization or similar
transaction shall be immediately delivered to the Company as Pledged Collateral
in the same form as so received (with any necessary endorsement).  Any other
dividends, distributions, or interest paid or payable in respect of, or
instruments and other property received, receivable, or otherwise distributed in
respect of, or in exchange for, any Pledged Collateral shall be paid to Barton.

       (iii) The Company shall execute and deliver (or cause to be executed and
delivered) to Barton all such proxies and other instruments as Barton may
reasonably request for the purpose of enabling him to exercise the voting and
other rights that he is entitled to exercise pursuant to paragraph (i) of this
Section 6(a).

   (b) When and so long as there is an Event of Default (i) involving failure to
make the payment described in Section 2 of the August 1998 Note, or (ii)
involving the voluntary placement by Barton of a lien upon  all or a significant
portion of the Pledged Collateral, all rights of Barton to exercise the voting
and other rights that he would otherwise be entitled to exercise pursuant to
Section 6(a)(i) shall cease, and all those rights shall become vested in the
Company, which shall then have the sole right to exercise those voting and other
rights.

7. Transfers and Liens.  Barton agrees that he will not (i) sell or otherwise
   -------------------                                                       
dispose of, or grant any option with respect to, any of the Pledged Collateral
without the prior written consent of the Company; or (ii) voluntarily create any
lien upon or with respect to any of the Pledged Collateral, except for the
security interest under this Agreement.

8. Events of Default; Remedies upon Default.
   ---------------------------------------- 

   (a) The following shall constitute Events of Default ("Events of Default")
under this Agreement:

       (i)  If Barton fails to perform or observe any term, covenant, or
Obligation under this Agreement or the August 1998 Note, or if any
representation or warranty made by Barton in this Agreement or the August 1998
Note is untrue or misleading in any material respect as of the date with respect
to which that representation or warranty was made;

       (ii) If a notice of lien, levy, or assessment is filed or recorded with
respect to all or a substantial part of the Pledged Collateral, except for a
lien that relates to current taxes not yet due and payable, and if the
applicable claim is not discharged or satisfied within ninety (90) days of
Barton's actual knowledge of that filing or recordation (such effected Pledged
Collateral shall hereinafter be referred to as the "Effected Collateral");

                                       3
<PAGE>
 
       (iii) If all or a substantial part of the Pledged Collateral is attached,
seized, or subjected to a writ or distress warrant, or is levied upon, or comes
within the possession of any receiver, trustee, custodian, or assignee for the
benefit of creditors, and that Pledged Collateral is not returned to Barton or
the writ, distress warrant, or levy is not dismissed, stayed, or lifted within
ninety (90) days (such effected Pledged Collateral shall hereinafter be referred
to as the "Effected Collateral").

       (iv)  Provided; however, with respect to subparagraphs 8(a)(ii) and (iii)
hereto, if prior to the end of such ninety (90) day period, Barton provides the
Company with additional collateral to secure the August 1998 Note with a Fair
Market Value (as defined in Section 11 hereto) equal to or exceeding the Fair
Market Value of the Effected Collateral, which collateral may be Shares or cash
(or such other collateral, subject to the consent of the Company, which consent
shall not be unreasonably withheld) at the discretion of Barton and which
collateral Barton hereby agrees shall be subject to the terms of this Agreement,
no Event of Default shall be deemed to have occurred.

   (b) When and so long as there is any Event of Default, the Company may
exercise in respect of the Pledged Collateral, in addition to other rights and
remedies provided for in this Agreement or otherwise available to it, all the
rights and remedies of a secured party upon a default under the Uniform
Commercial Code in effect in the State of California at that time.

   (c) Notwithstanding anything else contained herein to the contrary, so long
as there has been and is no Event of Default: (i) involving failure to make the
payment described in Section 2 of the August 1998 Note, or (ii) involving the
voluntary placement by Barton of a lien upon all or a significant portion of the
Pledged Collateral, Barton shall be entitled to exercise any and all voting and
other consensual rights pertaining to any or all of the Shares.

9. Expenses.  On demand, Barton will pay the Company all reasonable expenses,
   --------                                                                  
including attorneys' fees and costs, which the Company may incur in connection
with (i) the exercise or enforcement of any of the rights of the Company under
this Agreement; or (ii) Barton's failure to perform or observe any of the
provisions of this Agreement.

10. Security Interest Absolute.  All rights and security interests of the
    --------------------------                                           
Company, and all Obligations of Barton, under this Agreement shall be absolute
and unconditional irrespective of:  (i) any lack of validity or enforceability
of the August 1998 Note or any other agreement or instrument relating to it;
(ii) any change in the time, manner, or place of payment of, or in any other
term of, any of the Obligations, or any other amendment or waiver of or consent
to any departure from the August 1998 Note; (iii) any exchange, release, or non-
perfection of any other collateral, or any release, amendment, or waiver of any
of the Obligations; or (iv) any other circumstance that might otherwise
constitute a defense available to, or a discharge of, Barton in respect of the
Obligations or of this Agreement.

                                       4
<PAGE>
 
11. Adjustments; Release of Security.  The Company and Barton hereby agree:
    --------------------------------                                       

    (a) If at the end of any fiscal quarter of the Company, the Fair Market
Value of the Pledged Collateral is less than the balance due under the August
1998 Note, the Company shall notify Barton within ten (10) days.  Barton shall,
within forty-five (45) days of receipt of such notice, deposit with the Company
such additional cash, shares of common stock of the Company, or both, at the
option of Barton, with a value equal or greater than the deficiency, which
additional collateral shall be subject to the terms of this Agreement.  Each
such deposit pursuant to this Section 11(a) shall be reflected by an appropriate
notation to Schedule A hereto.

    (b) If at the end of any fiscal quarter of the Company, the Fair Market
Value of the Pledged Collateral is greater than the balance due under the August
1998 Note (the "Excess Collateral"), upon ten (10) days notice, Barton may
withdraw or cause the withdrawal of all or a portion of the Excess Collateral,
provided that no fractional Shares shall be released pursuant to this
subparagraph 11(b).  In lieu of any fractional Shares to which Barton would
otherwise be entitled, the Company shall pay cash equal to such fraction
multiplied by the Fair Market Value.  The release of shares and payment in lieu
of fractional shares pursuant to this Section 11(b) shall be reflected by an
appropriate notation to Schedule A hereto.

    (c) Upon fifteen (15) days prior written notice from Barton of his intent to
sell all or a portion of the Pledged Collateral, the Company may release such
Pledged Collateral (such  Pledged Collateral shall be referred to herein as the
"Released Collateral"), provided that prior to such release Barton provides the
Company with an undertaking that Barton will pay to the Company in cash an
amount equal to the Fair Market Value of such Released Collateral and any
interest relating thereto under the August 1998 Note as of the date of such
payment (which payment shall be reflected in the balance due to the Company from
Barton under the August 1998 Note) within five (5) business days of such sale.

    (d) For the purposes of this Agreement, the term "Fair Market Value" shall
mean; (i) if the Company's stock is not publicly traded on a national securities
exchange or the Nasdaq National Market System, as determined by the most recent
third-party valuation relating to the Shares, or (ii) if the Company's stock is
publicly traded on a national securities exchange or the Nasdaq National Market
System, as determined by the most recent closing price of the Company's stock.

12. Further Assurances.  Barton agrees that at any time and from time to time,
    ------------------                                                        
at his expense, Barton will promptly execute and deliver all further instruments
and documents, and take all further action, that may be necessary or desirable,
or that the Company may request, in order to perfect and protect any security
interest granted or purported to be granted by this Agreement or to enable the
Company to exercise and enforce its rights and remedies under this Agreement
with respect to any Pledged Collateral.

13. Entire Agreement; Amendment; Waiver.  This Agreement and the August 1998
    -----------------------------------                                     
Note embody the entire agreement of the parties hereto with respect to the
subject matter of this Agreement and supersede all prior agreements with respect
to that subject matter.  This Agreement may not be amended or modified except in
a writing signed by both parties.  No 

                                       5
<PAGE>
 
waiver of any provision of this Agreement shall be deemed to, or shall, operate
as a waiver of any other provision, whether or not similar, nor shall any waiver
constitute a continuing waiver. Except as expressly provided in this Agreement,
no waiver shall be binding unless executed in writing by the party making the
waiver.

14. Notices.  All notices and other communications provided for under this
    -------                                                               
Agreement shall be given as follows:

If to the Company:

                            TIER TECHNOLOGIES, INC.
                        1350 Treat Boulevard, Suite 250
                            Walnut Creek, CA  94596
                         Attn:  Chief Financial Officer

If to Barton:
                               WILLIAM G. BARTON
                            1028 Pebble Beach Drive
                               Clayton, CA  94517

15. Captions.  Captions are used for reference purposes only and should be
    --------                                                              
ignored in the interpretation of the Agreement.  Unless the context requires
otherwise, all references in this Agreement to Sections are to the sections of
this Agreement.

16. Governing Law; Terms.  This Agreement shall be governed by and construed in
    --------------------                                                       
accordance with the laws of the State of California applicable to contracts
wholly made and performed in the State of California.  Unless otherwise defined
above, terms defined in Division 9 of the Uniform Commercial Code as adopted in
the State of California are used in this Agreement with their statutory
meanings.

The parties have duly executed this Agreement as of the date first written
above.

TIER TECHNOLOGIES, INC.

By:   /s/ GEORGE K. ROSS
    --------------------------
      George K. Ross
Its:  Executive Vice President and
      Chief Financial Officer

WILLIAM G. BARTON

/s/ WILLIAM G. BARTON
------------------------------
William G. Barton

                                       6
<PAGE>
 
                           STOCK POWER AND ASSIGNMENT
                        SEPARATE FROM STOCK CERTIFICATE


  FOR VALUE RECEIVED and pursuant to that certain SECOND AMENDED AND RESTATED
PLEDGE AGREEMENT dated as of August 17, 1998 (the "Agreement"), the undersigned
hereby sells, assigns, and transfers to TIER TECHNOLOGIES, INC. (the "Company"),
__________ (__________) shares of Class A Common Stock of the Company, standing
in the undersigned's name or in the name of Tier Technologies, Inc. Voting Trust
(of which the undersigned is beneficial owner) on the books of the Company
represented by Certificate No(s). ______ delivered herewith.  The undersigned
does hereby irrevocably constitute and appoint the Secretary of the Company as
the undersigned's attorney-in-fact, with full power of substitution, to transfer
this stock on the books of the Company.  THIS ASSIGNMENT MAY ONLY BE USED AS
AUTHORIZED BY THE AGREEMENT.


DATED:  August 17, 1998


WILLIAM G. BARTON


/s/ WILLIAM G. BARTON
----------------------------
William G. Barton


Instructions:  Please sign this Stock Power above, but do not fill in any blanks
other than the signature lines.

The purpose of this Stock Power and Assignment Separate from Stock Certificate
is to enable the Company to acquire the Shares in accordance with the terms of
the Agreement.

                                       7
<PAGE>
 
                                   SCHEDULE A

                               PLEDGED SHARES AND
                                OTHER COLLATERAL


<TABLE>
<CAPTION>
                                                       FAIR MARKET VALUE OF         OTHER COLLATERAL
          DATE                 SHARES PLEDGED             SHARES PLEDGED                 /VALUE
          ----                 --------------          --------------------         ----------------     
<S>                            <C>                     <C>                          <C> 
    August 17, 1998               58,738                    $939,808                    
</TABLE>
                                        

                            SHARES RELEASED PURSUANT
                                TO SECTION 11(b)

         DATE                                          SHARES RELEASED
         ----                                          ---------------

                                       8