<PAGE>

                                                                   EXHIBIT 10.40

[PHARMCHEM INC. LETTERHEAD]

June 30, 2003

VIA FEDERAL EXPRESS

Messrs. Ted Janus and Will Edwards
Micro Cap Partners, L.P.
470 University Avenue
Palo Alto, CA 94301

Re: Repayment of Subordinated Promissory Note-Revised

Dear Messrs. Janus and Edwards:

         PharmChem, Inc. (the "Company") borrowed $750,000.00 (the "Loan") from
you pursuant to an Unsecured Subordinated Note and Warrant Purchase Agreement
dated September 12, 2001 and as evidenced by that certain Unsecured Subordinated
Promissory Note for $750,000.00 dated September 14, 2001 (the "Note"). In
connection with the Loan, the Company issued to you a warrant for 75,000 shares
of the Company's common stock (the "Original Warrant") at an exercise price of
$3.00 per share. The Company has agreed to repay the Loan prior to the original
maturity date and you have agreed to accept $375,000.00 (the "Repayment Amount")
as payment in full for the original principal amount of the Note, and unpaid
interest thereon of $50,625.00.

         Upon receipt of the Repayment Amount, you will mark the Note "paid in
full" and promptly return the Note to the Company.

         It is understood that the repayment of the Loan as described above is
contingent upon the Company successfully completing the new financing with
Silicon Valley Bank.

         In connection with the Company's repayment of the Loan, the Company has
further agreed to reissue the Original Warrant with a new per share exercise
price to be the average closing price of a share of the Company's common stock
for the thirty-day period ending June 26, 2003 (the "New Warrant"). As a
condition to our issuance of the New Warrant, you will need to return to the
Company the Original Warrant in the postage-paid, preaddressed envelope provided
herewith for that purpose and, upon our receipt of the Original Warrant, we will
issue to you the New Warrant. Further, if the Company is involved in a
transaction in which one or

<PAGE>

Repayment of Subordinated Promissory Note-Revised
Micro Cap Partners, L.P.
June 30, 2003
Page 2

both of the other holders of subordinated debt participate, the Company will
invite Palo Alto Investors LLC ("Palo Alto") to participate in such transaction
on terms comparable to those agreed upon with such other holder or holders. Such
participation by Palo Alto (if it chooses to do so) and/or its affiliated
entities shall be up to the prorata ownership of Palo Alto of the aforementioned
subordinated debt.

         BY YOUR SIGNING BELOW AND RETURNING THIS LETTER TO ME, FIRST, BY FAX AT
(817) 605-6402, AND, SECOND, BY OVERNIGHT MAIL USING THE ENCLOSED ENVELOPE,
INDICATING YOUR AGREEMENT TO AND APPROVAL OF THE ABOVE, PHARMCHEM WILL THEN
OVERNIGHT A CHECK TO YOU IN THE AMOUNT OF $425,625.00

                                   Sincerely,

                                   PharmChem, Inc.

                                   /s/ David A. Lattanzio
                                   -------------------------------
                                   David A. Lattanzio
                                   Vice President,
                                   Chief Financial Officer and
                                   Secretary

AGREED AND APPROVED:

____________________________
Micro Cap Partners, L.P.

By: /s/ William L. Edwards
    -----------------------------
Name:  William L. Edwards
Title: President/General Partner,
       Palo Alto Investors

Dated: June 30, 2003