Payment
*******

A participant's reward is the sum of a time reward and an optional
performance reward. "calculate_reward()" returns the reward
accumulated so far, in the currency set by the "currency"
configuration key (default "$").


Time reward
===========

Every page and trial has a "time_estimate" in seconds. When a
participant completes part of the timeline, PsyNet adds its time
estimate to their time credit, and pays that credit at "wage_per_hour"
(default "9.0"). New experiments set it in "config.txt":

   currency = £
   wage_per_hour = 12.0

A key can be set in "config.txt" or in the experiment class's "config"
dictionary, but not both.

"psynet estimate" reports the maximum time reward and the duration of
the longest route through the timeline:

   psynet estimate


Performance reward
==================

A performance reward can be allocated after each trial, at the end of
a trial maker, or both; the two add up.

"Trial.compute_performance_reward" runs after each trial. It receives
the "score" returned by "score_answer()". The "static" demo pays one
cent per point:

       def compute_performance_reward(self, score):
           # Here we give the participant 1 cent per point immediately after each trial.
           return 0.01 * score

The trial maker's "compute_performance_reward" runs once at the end of
the trial maker, after the final performance check. It receives the
check's "score" and "passed" values, and runs only if the trial maker
has "check_performance_at_end=True":

       def compute_performance_reward(self, score, passed):
           # At the end of the trial maker, we give the participant 1 dollar for each point.
           # This is combined with their trial-level performance reward to give their overall performance reward.
           return 1.0 * score

Both methods return "0.0" by default. Code outside a trial maker can
add to the performance reward with
"participant.inc_performance_reward(amount)".


Base payment and bonus
======================

The recruitment platform pays a fixed "base_payment" (default "0.10"),
which you set in the configuration and which is advertised with the
study. When the participant finishes, the recruiter decides the
payment and PsyNet pays the rest as a bonus:

   bonus = max(0, reward - base_payment)

A participant whose reward is at least the base payment receives
exactly their reward in total. A participant whose reward is below the
base payment still receives the full base payment and no bonus. Set
"base_payment" at or below the smallest reward you expect from a
successful participant; for a timeline without optional parts, that is
the reward from "psynet estimate".

Prolific requires "base_payment" alone to meet its minimum hourly rate
(£6 or $8), measured over participants' median completion time;
bonuses don't count. When the recruiter is Prolific, "psynet estimate"
warns if "prolific_estimated_completion_minutes" is shorter than its
estimate, or if "base_payment" over the longer of the two durations
falls below Prolific's minimum.

To change how a recruiter computes the payment, subclass it and
override "decide_payment()", "platform_base_for()" or "total_owed()".


Leaving early
=============

Participants who fail a check, leave with the footer **Leave** button
("show_early_exit_button"), or hit an error are paid for the parts
they completed. Paid Leave is offered only once their reward reaches
"min_reward_for_paid_early_exit" (default "0.20"). How the payment is
split depends on the recruiter:

* **Prolific** pays a fixed screen-out amount
  ("prolific_unsuccessful_base_payment", default "0.25"), and PsyNet
  tops the participant up to their reward with a bonus. With
  "prolific_unsuccessful_topup = false", the time reward is forfeited
  and the participant receives only the screen-out amount plus any
  performance reward. With "prolific_pay_unsuccessful = false", the
  participant is asked to return the submission instead, and their
  whole reward is paid as a bonus. See Prolific.

* **CINT** (Lucid) pays participants through the panel; PsyNet pays no
  base payment or bonus. See CINT (Lucid).

* **Lab Recruiter** receives the outcome from PsyNet, and payment
  follows the lab's payment process. See Lab Recruiter.


Payment limits
==============

Three limits protect the budget. They are experiment variables, not
configuration keys:

"max_participant_payment" (default "25.0")
   The most one participant can receive, base payment included. A
   bonus that would exceed it is reduced to the remaining amount.

"soft_max_experiment_payment" (default "1000.0")
   Recruitment stops once "amount_spent()" reaches this value.
   Participants already in the experiment can still finish and be
   paid, so the total can go past this limit.

"hard_max_experiment_payment" (default "1100.0")
   No bonus is paid beyond this total. A bonus that would exceed it is
   reduced to the remaining amount, or not paid if less than 0.01
   remains, and the participant's bonus status is recorded as
   "capped". The participant's "planned_bonus" keeps the amount
   decided before the cap, and "bonus" records what was paid.

"amount_spent()" adds up the base payments and bonuses of all
participants, including the base payment reserved for participants who
have started but not finished. When a limit is reached, PsyNet emails
the experimenter.

Set the initial values in the "variables" dictionary of the experiment
class:

   class Exp(psynet.experiment.Experiment):
       variables = {
           "max_participant_payment": 10.0,
           "soft_max_experiment_payment": 500.0,
           "hard_max_experiment_payment": 550.0,
       }

While the experiment runs, the soft and hard experiment limits can be
changed on the dashboard's **Monitor > Timeline** page.
