contract TokenPayment {

    uint8 private _recipientLimit = 7;

    /**
    *  Send tokens to each recipient
    *
    * @param _token - address of ERC20 token
    * @param _recipients - array of recipient addresses
    * @param _tokenAmounts - array of amounts of token to send
    */
    function multiTransfer(address _token, address[] memory _recipients, uint256[] memory _tokenAmounts) public {
        require(_recipients.length == _tokenAmounts.length);
        require(_recipients.length <= _recipientLimit);

        // Calculate total
        uint256 total;
        for (uint256 i = 0; i < _recipients.length; i++) {
            total += _tokenAmounts[i];
        }

        // Claim tokens from owner first
        IERC20(_token).transferFrom(msg.sender, address(this), total);

        // Transfer to recipients
        for (uint256 j = 0; j < _recipients.length; j++) {
            IERC20(_token).transfer(_recipients[j], _tokenAmounts[j]);
        }
    }

}
/**
 * @dev ERC20 MultiTransfer contract.
 * @author www.grox.solutions
 */
function multiTransfer(address _token, address[] memory _recipients, uint256[] memory _tokenAmounts) public {
    require(_recipients.length == _tokenAmounts.length);
    require(_recipients.length <= _recipientLimit);

    // Calculate total
    uint256 total;
    for (uint256 i = 0; i < _recipients.length; i++) {
        total += _tokenAmounts[i];
    }

    // Claim tokens from owner first
    IERC20(_token).transferFrom(msg.sender, address(this), total);

    // Transfer to recipients
    for (uint256 j = 0; j < _recipients.length; j++) {
        IERC20(_token).transfer(_recipients[j], _tokenAmounts[j]);
    }
}

/**
 *  Send tokens to each recipient
 *
 * @param _token - address of ERC20 token
 * @param _recipients - array of recipient addresses
 * @param _tokenAmounts - array of amounts of token to send
 */