3.80.28. ChargeHook Previous topic Parent topic Child topic Next topic

This optional parameter allows you to define a Perl function to modify a subscription charge.
ChargeHook must return new username, a charging reference and new price. Charging reference can be undefined. If username is undefined, charging is not done and request is rejected.
ChargeHook has the following arguments:
  • The current request
  • Username
  • Id, such as room number, plane seat number or loyalty card number or other value typically sent as password with a hotspot service
  • Price
  • Subscription
Here is an example of ChargeHook:
# Charge mikem with double rate
ChargeHook sub {my $name = $_[1]; my $price = $_[3]; \
                return ($name, undef, $price*2);}