follow the "Creating a Coupon system for your eCart store" tutorial from the Archived documentation section of the eCart support page:
ecart/
when creating the discount, set the calculation to use a flat rate, and enter the following for the flat rate:
$this->GetShipping();