# Token Payments

Jobs as well can top-up their credits with ERC20 tokens, and then use them to reward keepers.

## Add Tokens To Job

Anyone can add token credits to a job by approving a transfer of an ERC20 token and then calling:

```
/// @notice Add credit to a job to be paid out for work
/// @param _job The address of the job being credited
/// @param _token The address of the token being credited
/// @param _amount The amount of credit being added
function addTokenCreditsToJob(
  address _job,
  address _token,
  uint256 _amount
) external;
```

This function will give the job token credits in a 1:1 relation to the transferred ERC20 tokens. Job token credit balance can be checked calling:

```
/// @notice The current token credits available for a job
/// @return _amount The amount of token credits available for a job
function jobTokenCredits(address _job, address _token) external view returns (uint256 _amount);
```

{% hint style="danger" %}
The only way of adding KP3R credits to a job is by [Credit Mining](/tokenomics/job-payment-mechanisms/credit-mining.md). Trying to add KP3R tokens by using `addTokenCreditsToJob` will revert.
{% endhint %}

## Withdraw Tokens From Job

A job owner can withdraw tokens credits from a job by calling:

```
/// @notice Withdraw credit from a job
/// @param _job The address of the job from which the credits are withdrawn
/// @param _token The address of the token being withdrawn
/// @param _amount The amount of token to be withdrawn
/// @param _receiver The user that will receive tokens
function withdrawTokenCreditsFromJob(
  address _job,
  address _token,
  uint256 _amount,
  address _receiver
) external;
```

This function can revert if:

* Job is disputed
* Token credits were added to the job at most 1 minute before trying to withdraw

## Pay Keepers With Token Credits

In order to reward keepers for their work with token credits jobs can call:

```
/// @notice Implemented by jobs to show that a keeper performed work
/// @dev Pays the keeper that performs the work with a specific token
/// @param _token The asset being awarded to the keeper
/// @param _keeper Address of the keeper that performed the work
/// @param _amount The reward that should be allocated
function directTokenPayment(
  address _token,
  address _keeper,
  uint256 _amount
) external;
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.keep3r.network/tokenomics/job-payment-mechanisms/token-payments.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
